#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2011
    Posts
    8
    Rep Power
    0

    Vlookup Excel VBA


    The premise of my code is to run a macro after a user inputs the data then they can run the macro to lookup the text in cell B9 to B400 to find the # corresponded with that text on another sheet.

    Right now i'm running it and just getting "Not found" in all my specified cells.

    Any recommendations?


    Code:
    Public Sub vlookup()
    Dim rng As Range
    
    h = 9
    Do While h < 400
    
    Cells(h, 4).Value = Application.[VLookup(Worksheet("Resource Load Breakdown").Range(h, 2), Worksheet("PlanIT #'s").Range("A2:B400"), 2, True)]
    
    If IsError(Cells(h, 4).Value) Then
    Cells(h, 4).Value = "Not Found"
    
    End If
    
    On Error Resume Next
    
    h = h + 1
    Loop
    
    
    End Sub
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2011
    Posts
    8
    Rep Power
    0
    Originally Posted by cmorse723
    The premise of my code is to run a macro after a user inputs the data then they can run the macro to lookup the text in cell B9 to B400 to find the # corresponded with that text on another sheet.

    Right now i'm running it and just getting "Not found" in all my specified cells.

    Any recommendations?


    Code:
    Public Sub vlookup()
    Dim rng As Range
    
    h = 9
    Do While h < 400
    
    Cells(h, 4).Value = Application.[VLookup(Worksheet("Resource Load Breakdown").Range(h, 2), Worksheet("PlanIT #'s").Range("A2:B400"), 2, True)]
    
    If IsError(Cells(h, 4).Value) Then
    Cells(h, 4).Value = "Not Found"
    
    End If
    
    On Error Resume Next
    
    h = h + 1
    Loop
    
    
    End Sub
    Any help?

IMN logo majestic logo threadwatch logo seochat tools logo