Hi,
I have a combobox that is misbehaving. It has a change event that should change a label on the same userform depending on the combobox value that is selected. To do this I use the worksheet function 'vlookup', but whenever the code runs, I get a run-time error 1004. The problem seems to be in the use of vlookup, but this method works on another combobox (referencing text) on the same userform. My code is below:
'LblProjName' is the label being changed
'CboJobNo' is the combobox being changed
'Job_List' is a named range in the worksheet of two columns with job numbers in the first (stored as numbers) and corresponding job names in the second (stored as text).
The error message is as follows:
"Unable to get the VLookup property of the WorksheetFunction class"
Does anyone know where I am going wrong? Any help would be greatly appreciated.
I have a combobox that is misbehaving. It has a change event that should change a label on the same userform depending on the combobox value that is selected. To do this I use the worksheet function 'vlookup', but whenever the code runs, I get a run-time error 1004. The problem seems to be in the use of vlookup, but this method works on another combobox (referencing text) on the same userform. My code is below:
Code:
Private Sub CboJobNo_Change()
LblProjName.Caption = Application.WorksheetFunction.VLookup(CboJobNo.Value, Range("Job_List"), 2, False)
End Sub
'LblProjName' is the label being changed
'CboJobNo' is the combobox being changed
'Job_List' is a named range in the worksheet of two columns with job numbers in the first (stored as numbers) and corresponding job names in the second (stored as text).
The error message is as follows:
"Unable to get the VLookup property of the WorksheetFunction class"
Does anyone know where I am going wrong? Any help would be greatly appreciated.