+ Reply to Thread
Results 1 to 3 of 3

Use of Variable Sheet Name in VBA Formula - Update Reference

  1. #1
    Forum Contributor
    Join Date
    07-28-2008
    Location
    Leamington Spa, UK
    MS-Off Ver
    2010
    Posts
    142

    Question Use of Variable Sheet Name in VBA Formula - Update Reference

    Hi All,

    Below are certain extracts of my code:

    Please Login or Register  to view this content.
    The above Code refers to a Concatenate formula I am running in a macro. It refers to two variables, the first being the worksheet 'SheetName' and the second being the Row reference 'xStart'. 'SheetName' is derived from the value of a user selection in a combobox.

    It runs however it comes up with an 'update reference' dialog box for the reference for the sheet. If I click cancel it leaves #NAME in the A1 Cell. If I look at the formula that the VBA has input into this cell it is correct apart from the apostrophes that surround the sheet, SheetName. Thus it thinks its just text. If I manually put these apostrophies in the formula works fine. Can someone advise as to how to modify the above to get it to work?

    Thanks in Advance
    Mark
    Last edited by R_S_6; 08-10-2010 at 02:08 PM.

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,016

    Re: Use of Variable Sheet Name in VBA Formula - Update Reference

    Try changing this:
    Please Login or Register  to view this content.
    to this:
    Please Login or Register  to view this content.
    Everyone who confuses correlation and causation ends up dead.

  3. #3
    Forum Contributor
    Join Date
    07-28-2008
    Location
    Leamington Spa, UK
    MS-Off Ver
    2010
    Posts
    142

    Thumbs up Re: Use of Variable Sheet Name in VBA Formula - Update Reference

    romperstomper - that worked great!

    Thanks for your reply - Much appreciated!
    Mark

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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