+ Reply to Thread
Results 1 to 3 of 3

How to use sheet name in Vlookup using user input

  1. #1
    Registered User
    Join Date
    11-04-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1

    How to use sheet name in Vlookup using user input

    I'm a complete newbie at the entire VBA/Macro world, but what I'd like to do is this:

    I have a workbook with about 60 sheets in it, more to be added, each sheet with a unique character name. I would like to be able to, on the first worksheet, enter the name of the character, and have it do a vlookup on the character stats on that character's worksheet. Is this at all possible?

    The code I have right now looks something like this:
    Please Login or Register  to view this content.
    But that obviously doesn't work.

    Any help would be greatly appreciated.

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: How to use sheet name in Vlookup using user input

    =VLOOKUP("Strength", INDIRECT("'"&B1&"'!a1:g200"),7,FALSE) wher b1 is character name and a1:g200 is the range on that sheet,i assume they are all the same ranges
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  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
    44,434

    Re: How to use sheet name in Vlookup using user input

    =VLOOKUP("Strength", 'CharacterName'!A1:G2000, 7, FALSE)

    where CharacterName is the name of the sheet. You only need the single quotes if there are spaces in the sheet name. ! is the delimiter between the sheet name and the range.

    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


+ 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