Results 1 to 5 of 5

Thread: VLookup (2003)

  1. #1
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    milton keynes, Buckinghamshire
    Posts
    252
    Thanks
    0
    Thanked 0 Times in 0 Posts

    VLookup (2003)

    All

    I have tried various iterations of the function below without success.

    Cells(i,16).value = application.WorksheetFunction.VLookup(strtemp, &"'CF Auto Accruals P12'!"& AQ:AR,2,FALSE)

    Can someone please advise what the correct syntax is?

  2. #2
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VLookup (2003)

    This works for me:

    <pre> Cells(I, 16).Value = Application.WorksheetFunction.VLookup(strTemp, Range("'CF Auto Accruals P12'!AQ:AR"), 2, False)
    </pre>

    Legare Coleman

  3. #3
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    milton keynes, Buckinghamshire
    Posts
    252
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VLookup (2003)

    Legare

    Thanks, this was probably the only combination I did not try.

    Do you by any chance have an explanation of the logic behind the syntax.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: VLookup (2003)

    Legare probably sleeps at the moment. The second argument to VLookup is a range, not a string. Legare used Range("...") to specify the range with the supplied address.

  5. #5
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: VLookup (2003)

    The moment you use the concatenate symbol, it converts to a string value. Refering to the sheet as Legare did, keeps it as Range syntax. (Notice the single apostrophies around the sheet name too!)
    Regards,
    Rudi

Posting Permissions

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