I am having trouble getting my VBA Vlookup to work and hope the exterts out there might be able to assist.
I use a global variable to transfer a variable value from another userform within the same workbook.
The bidea is then to place this number into a text box (called txtTContractID) and use the change to then go and lookup the values for the other text boxes, along the lines of:
but I get a "Could not set the Value property - Type Mismatch error' The lookup up is not returning the right value.
I use a global variable to transfer a variable value from another userform within the same workbook.
Code:
Private Sub UserForm_Initialize()
Dim ws As Worksheet
Set ws = Worksheets("Contingency")
txtTCID = GlobalContractID
End Sub
The bidea is then to place this number into a text box (called txtTContractID) and use the change to then go and lookup the values for the other text boxes, along the lines of:
Code:
Private Sub txtTCID_Change()
txtTProjectID.Value = Application.VLookup(Me.txtTCID, Range("tblContracts"), 2, False)
End Sub
but I get a "Could not set the Value property - Type Mismatch error' The lookup up is not returning the right value.