+ Reply to Thread
Results 1 to 6 of 6

Vlookup in Macro

  1. #1
    Registered User
    Join Date
    01-10-2014
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    57

    Vlookup in Macro

    Hi,

    Just wanted to know whether it was possible to have a vlookup in my current macro. Heres a short version of it

    Please Login or Register  to view this content.
    So essentially, I want to replace sTab with a vlookup dependent on what sName is selected which would be a drop down.

    Please Login or Register  to view this content.
    So something along the lines of:

    Please Login or Register  to view this content.
    This obviously isn't correct but its a general idea of what i'm looking for

    Thanks
    Last edited by shiser; 05-22-2014 at 01:12 PM.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,725

    Re: Vlookup in Macro

    Here is the direct translation but I'm not clear on what you're trying to accomplish. I don't know how I4 and D4:G16 fit into the picture.

    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    01-10-2014
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    57

    Re: Vlookup in Macro

    Didn't work

    So basically the vlookup is dependent on what is selected = "sname" which is located in cell "I4" of sheet 35.

    In sheet 35, it'll lookup up I4 in the range D4:G16 picking the result of what appears in the second column

  4. #4
    Registered User
    Join Date
    01-10-2014
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    57

    Re: Vlookup in Macro

    Nevermind! I've found a work around

  5. #5
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,725

    Re: Vlookup in Macro

    If you're happy, I'm happy, but I am curious about what "didn't work" means. If those ranges are in a different sheet than the active sheet, then you will have to qualify the references explicitly. Also interested in your workaround.

  6. #6
    Registered User
    Join Date
    01-10-2014
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    57

    Re: Vlookup in Macro

    One of the reasons why I wanted the vlookup in the macro was so it'll automatically calculate without me having to press F9. Instead however, I put the vlookup in excel, hid the columns and inserted calculate.sheet into my macro. Seems an easy workaround for me.

+ 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] Macro- adding Vlookup to a macro
    By TERRI LEE in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 05-06-2013, 02:28 AM
  2. [SOLVED] Adapt A Sumif Macro to A Vlookup Macro
    By timbo1957 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-30-2012, 06:22 PM
  3. Complex Vlookup/ VBA function or Macro Needed For "if contains text then vlookup"
    By alfykunable in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-09-2012, 03:48 AM
  4. Applying Vlookup using a Macro(Vlookup+Macro) in Excel 2007
    By Sumku in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-03-2009, 08:58 PM
  5. Replies: 1
    Last Post: 02-26-2005, 02:06 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