+ Reply to Thread
Results 1 to 9 of 9

Can anyone tell me why my cells reference doesn't work in 2010

  1. #1
    Registered User
    Join Date
    09-20-2012
    Location
    New york
    MS-Off Ver
    Excel 2003
    Posts
    45

    Can anyone tell me why my cells reference doesn't work in 2010

    I have had no issue with excel 2003 using the cell reference but in 2010 when i try to use this reference in the application it either skips over my commands with out entering a value or returns a runtime error(1004).

    it only works with the sheet is identified ex...sheets("Sheet1") or activesheet.

    Below is the simple macro I used to test this out

    Please Login or Register  to view this content.
    Last edited by Darthzo; 03-27-2014 at 11:16 AM. Reason: Adding code tags

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,617

    Re: Can anyone tell me why my cells reference doesn't work in 2010

    first line writes to A1 in Sheet1
    second to A2 in active sheet (it has to be a worksheet - cannot be for instance graph)
    third selects A2 in active sheet (it has to be a worksheet)

    if sheet1 is not an active sheet you will get both tests written into different sheets
    If there is no Sheet1 in your workbook You will receive an error 9 - subscript out of range
    As of error 1004 - isn't a sheet/workbook protected?

    PS. Please use code tags as requested by forum rules (edit your post)
    Last edited by Kaper; 03-27-2014 at 11:00 AM.
    Best Regards,

    Kaper

  3. #3
    Registered User
    Join Date
    09-20-2012
    Location
    New york
    MS-Off Ver
    Excel 2003
    Posts
    45

    Re: Can anyone tell me why my cells reference doesn't work in 2010

    Test book.xlsx

    Thank you Kaper

    I have checked all three sheets in the workbook with only the code showing that has the "sheets1" reference actually posting data to the cells. See attachment

  4. #4
    Registered User
    Join Date
    09-20-2012
    Location
    New york
    MS-Off Ver
    Excel 2003
    Posts
    45

    Re: Can anyone tell me why my cells reference doesn't work in 2010

    Attachment 307414

    Thank you Kaper

    I have checked all three sheets in the workbook with only the code showing that has the "sheets1" reference actually posting data to the cells. Also the workbook does not have any protection. See attachment

  5. #5
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Can anyone tell me why my cells reference doesn't work in 2010

    where's the code located?
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  6. #6
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Can anyone tell me why my cells reference doesn't work in 2010

    Hi,

    Seems to work OK for me. The workbook you posted is of course a .xlsx and by definition doesn't contain any macros so not quite sure why you attached it.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  7. #7
    Registered User
    Join Date
    09-20-2012
    Location
    New york
    MS-Off Ver
    Excel 2003
    Posts
    45

    Re: Can anyone tell me why my cells reference doesn't work in 2010

    Sorry I actually had the code in my personal workbook. I was using that workbook at the time to test the macro. I am feeling this could be a settings issue as when i used my macros earlier in the week I had no issues.

  8. #8
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Can anyone tell me why my cells reference doesn't work in 2010

    ...maybe, although I suspect Excel 2007 onwards has perhaps been a bit more fussy about explicitly including sheet (and sometimes workbook) names when defining ranges.

  9. #9
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Can anyone tell me why my cells reference doesn't work in 2010

    which module in the personal workbook was the code in? if it was in a worksheet module the second line would write to that sheet not the active sheet and the third line would error because you can't select the sheet in the personal workbook

+ 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. Excel 2010 Paste Doesn't work twice
    By MrsRobinson in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-13-2013, 11:06 AM
  2. Replies: 0
    Last Post: 09-18-2012, 11:24 AM
  3. Indirect doesn't work even if files are open - office 2010
    By Alexander_Golinsky in forum Excel General
    Replies: 0
    Last Post: 08-07-2012, 02:24 AM
  4. 2010 spreadsheet doesn't work in 2003
    By dragonlor20 in forum Excel General
    Replies: 6
    Last Post: 03-14-2011, 01:13 PM
  5. Run doesn't work in reference workbook
    By foxguy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-09-2010, 02:55 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