Consulting

Results 1 to 2 of 2

Thread: Using a defined string in a vlookup

  1. #1
    VBAX Newbie
    Joined
    Apr 2010
    Posts
    1
    Location

    Using a defined string in a vlookup

    I have been trying to figure out how to use a defined string in a vlookup. I am trying to reference a different workbook to the one I am on and this will change every month, any ideas?

    I have a work round in that I can save this file as a lookup sheet and reference this workbook but I'm sure there is an easier way, can anyone help?

    Would want to change this from
    ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-13],'Lookup'!C[-13]:C[-12],1,FALSE)"

    to state the defined workbook at the top e.g. Testfile

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-13],'" & Testfile & "'!C[-13]:C[-12],1,FALSE)"
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •