I am creating a userform where based on a drop down list of items called "ContractsList" I would like a Vlookup formula to return a text data in "TextBox 1".
I get an error message saying "Run-time error'1004': Unable to get the Vlookup property of the worksheetfunction class
Not sure what I am doing wrong, here is my code if anyone can spot the error.
Private Sub ContractsList_AfterUpdate()
If WorksheetFunction.CountIf(Sheet2.Range("A:A"),Me.ContractsList.Value) = 0 Then
MsgBox "This contract is not on the list"
Me.ContractsList.Value = ""
Exit Sub
End If
'Lookup values based on first control
With Me
.TextBox1 = Application.WorksheetFunction.VLookup(Me.TextBox1, ("B5:B72"), 2, 0)
End With
End Sub