+ Reply to Thread
Results 1 to 4 of 4

Sheets and variables

  1. #1
    Forum Contributor
    Join Date
    02-16-2012
    Location
    London, England
    MS-Off Ver
    Excel mac 2011
    Posts
    238

    Sheets and variables

    How do I get to use a variable as a name for a sheet?

    Please Login or Register  to view this content.
    Doesn't work

    Please Login or Register  to view this content.
    Doesn't work

    jn is a string, the name of the sheet is the same string as I got it from there. I just keep getting "Subscript out of range" and it doesn't make sense to me.

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

    Re: Sheets and variables

    This should work provided jn holds a value that is a valid sheet name in the active workbook.
    Please Login or Register  to view this content.
    PS You might want to check for leading/trailing spaces.
    If posting code please use code tags, see here.

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,539

    Re: Sheets and variables

    Please Login or Register  to view this content.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,539

    Re: Sheets and variables

    Thanks for the rep.



    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

+ 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. look up on several sheets from three variables
    By tcmuell in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-03-2014, 03:19 PM
  2. With Sheets statement doesn't like variables
    By tahano54 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-28-2014, 02:35 AM
  3. Adding VLOOKUPS across multiple sheets and variables
    By a_l_e_x in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-26-2013, 03:52 AM
  4. Having an issue with variables across sheets
    By cosmicwinds in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-28-2013, 12:26 AM
  5. Is this possible? How? 2 sheets/2 variables
    By Nadjim in forum Excel General
    Replies: 7
    Last Post: 02-11-2007, 08:05 AM
  6. [SOLVED] find simillar variables in 2 different sheets
    By mohammed in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 08-15-2006, 10:00 PM
  7. using variables to reference sheets
    By marksince1984 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-15-2006, 06:29 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