+ Reply to Thread
Results 1 to 3 of 3

Variable sheet name reference not working in VBA formula?

  1. #1
    Forum Contributor
    Join Date
    05-23-2007
    Posts
    127

    Variable sheet name reference not working in VBA formula?

    I've got code to rename a sheet based on cell contents:

    Please Login or Register  to view this content.
    And it works beautifully 'most' of the time, when acting directly on the sheet, like this:

    Please Login or Register  to view this content.
    It doesn't work, however, when used during formula creation... see code below. I get a couple of "Update Values: sheetName1" during execution. Doesn't keep the macro from finishing, but those formulae don't work properly.

    Please Login or Register  to view this content.
    Any help and/or direction is greatly appreciated!

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: Variable sheet name reference not working in VBA formula?

    As it is the formula in that last code will be looking for sheet with the literal name 'sheetName1'.

    Try this.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    05-23-2007
    Posts
    127

    Re: Variable sheet name reference not working in VBA formula?

    Thank you! That's what I figured, but didn't know the fix... beautiful!

+ 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] Vlookup formula with variable file name and sheet name not working....help!
    By orozvik in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-31-2015, 10:36 AM
  2. Replies: 1
    Last Post: 05-06-2013, 05:20 PM
  3. Sheet is variable... - formula not working
    By madars in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-08-2011, 06:39 AM
  4. Use of Variable Sheet Name in VBA Formula - Update Reference
    By R_S_6 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-10-2010, 03:20 AM
  5. variable sheet reference
    By aosnatca in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-19-2010, 03:10 PM
  6. Variable Sheet Reference
    By telton in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-29-2007, 02:02 AM
  7. reference a sheet with variable?
    By pgag45 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-15-2007, 04:08 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