Hi Guys,
Hope you all had a great New Years!
First day back in work and I'm already at a stumbling block... Can anyone please offer advice on why this IF statement is trying to carry out the code after Else even though the initial part of the IF statement is TRUE?
It's a combo box, I select an employee and the Vlookup pulls in their hourly rate from another worksheet. Once the user clicks Save, it runs;
Which then prompts this section of code. Its supposed to check for Null values and then just populate the txtHourly box with a 0 if nothing is detected as selected in the combobox. I receive an error 1004 "Unable to get the Vlookup property etc etc" which means its trying to carry out the latter part of the code even though the combobox has nothing in it!
Hope you can help
Hope you all had a great New Years!
First day back in work and I'm already at a stumbling block... Can anyone please offer advice on why this IF statement is trying to carry out the code after Else even though the initial part of the IF statement is TRUE?
Code:
Private Sub cbbEmployee_Change()
Dim EmpName As Variant
If IsNull(Me.cbbEmployee.Value) Then
txtHourly.Value = "0"
Else
EmpName = cbbEmployee.Value
txtHourly.Value = WorksheetFunction.VLookup(EmpName, Worksheets("Formulas").Range("T1:U53"), 2, False)
End If
End Sub
It's a combo box, I select an employee and the Vlookup pulls in their hourly rate from another worksheet. Once the user clicks Save, it runs;
Code:
me.cbbEmployee.Clear
Which then prompts this section of code. Its supposed to check for Null values and then just populate the txtHourly box with a 0 if nothing is detected as selected in the combobox. I receive an error 1004 "Unable to get the Vlookup property etc etc" which means its trying to carry out the latter part of the code even though the combobox has nothing in it!
Hope you can help