Experimenting with Vlookup function in VBA and not getting a result with the code below. The problem seems to be in the "Sub cboLocation"...pointing to the Vlookup formula itself.
Private Sub cboLocation_AfterUpdate()
Dim LookupLists As Sheets
Dim cboLocation As ComboBox
Dim txtAppID As TextBox
Dim UserVLookup As Workbooks
Me.txtAppID.Value = WorksheetFunction.VLookup(Trim(Me.cboLocation.Value), Workbooks("UserVLookup").Sheets("LookupLists").Range("A1:H13").Value, 3, False)
End Sub
Private Sub UserForm_Initialize()
Dim cLoc As Range
Dim ws As Worksheet
Set ws = Worksheets("LookupLists")
For Each cLoc In ws.Range("Vvalue")
With Me.cboLocation
.AddItem cLoc.Value
End With
Next cLoc
End Sub
Bookmarks