Consulting

Results 1 to 4 of 4

Thread: Vlookup Error

  1. #1

    Vlookup Error

    Hi,

    I get this error "unable to get vlookup property of worksheetfunction class" when i use the below code. Can somebody please help

    recNum5 = 2
    Do Until wb5.Sheets("Notes").Range("B" & recNum5) = ""
    lookup_value = wb5.Sheets("Notes").Range("B" & recNum5).Value
    path = wb4.Sheets("Report1").Range("E3:H2000")
    On Error GoTo MyError:
    x = WorksheetFunction.VLookup(lookup_value, path, 4, False) ---- Get error here
    wb5.Sheets("Notes").Range("P" & recNum5).Value = x
    MyError:
    If Err.Number = 1004 Then wb5.Sheets("Notes").Range("P" & recNum5).Value = "NR"
    recNum5 = recNum5 + 1
    Loop

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Can't see why. Can you post your workbook?
    ____________________________________________
    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

  3. #3
    It runs for the first lookup value but then gives error for second

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Can't see why. Can you post your workbook?
    ____________________________________________
    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
  •