Dear all
I have the following code, I am trying to check if there is a value above 0 through the lookup.
In case it is not obvious what I doing. I have a UserForm active and am using the labels in the form as the lookup value (variable a)
I pass this to the lookup but get an error.
Unable to get the Vlookup property of the WorksheetFuction class.
I have looked through various forums on line and I still think I have this correct but it not working.
If I remove the variable element and just put the value instead of the variable it works.
When I stepin I can see the value of "a" is correct
What am I doing wrong?
thanks a lot
I have the following code, I am trying to check if there is a value above 0 through the lookup.
Code:
Dim a As String
For Each cCont In Me.Controls
If TypeName(cCont) = "Label" Then
a = cCont.Caption
End If
b = Application.WorksheetFunction.VLookup(a, Sheet1.Range("C4:I24"), 7, False)
If b > 0 Then
MsgBox "You have management time in the quote" & vbCrLf & "Please remove and rerun", _
vbCritical, "CHECK"
UserForm.Hide
Exit Sub
End If
Next cCont
In case it is not obvious what I doing. I have a UserForm active and am using the labels in the form as the lookup value (variable a)
I pass this to the lookup but get an error.
Unable to get the Vlookup property of the WorksheetFuction class.
I have looked through various forums on line and I still think I have this correct but it not working.
If I remove the variable element and just put the value instead of the variable it works.
When I stepin I can see the value of "a" is correct
What am I doing wrong?
thanks a lot