+ Reply to Thread
Results 1 to 5 of 5

Can not change cells from VBA

  1. #1
    Registered User
    Join Date
    01-21-2015
    Location
    tn.
    MS-Off Ver
    2000
    Posts
    12

    Can not change cells from VBA

    tried to change cells from VBA with:

    worksheets("sheet1").cells(10,"A")

    statement does not execute. Just aborts

  2. #2
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Can not change cells from VBA

    You need to assign a value. Change your codee to Worksheets("Sheet1").cells(10, "A").value = "XYZ"

  3. #3
    Registered User
    Join Date
    01-21-2015
    Location
    tn.
    MS-Off Ver
    2000
    Posts
    12

    Re: Can not change cells from VBA

    sorry I meant

    worksheets("sheet1").cells(10,"A")="OK"

  4. #4
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Can not change cells from VBA

    Works for me.

  5. #5
    Registered User
    Join Date
    01-21-2015
    Location
    tn.
    MS-Off Ver
    2000
    Posts
    12

    Re: Can not change cells from VBA

    The entire code is:

    Public Function Test() as String
    worksheets("sheet1").cells(10,"A").value="OK"
    Test="OK"
    End Function

    When type =test() into a cell and hit return it puts #Value in that cell and nothing in cell A10.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Linking cells globally to allow users the ability to change cells on separate sheet/cells.
    By V1gilante in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-18-2014, 10:47 PM
  2. Replies: 1
    Last Post: 03-19-2013, 08:52 AM
  3. Replies: 15
    Last Post: 04-17-2012, 08:19 AM
  4. auto change cell formula on condition of worksheet change in other cells
    By futurejock in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-01-2009, 12:11 AM
  5. [SOLVED] change info in other cells when i change a number in a drop list?
    By macbr549 in forum Excel General
    Replies: 2
    Last Post: 09-10-2005, 10:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1