Hi
I have a question..how do you create a validation in userform?
I have a textbox on the userform..
and this texbox is link to A1 (meaning if i key in a number in the textbox, it will flow to cell A1 of my worksheet).
However i need to input a criteria...and my criteria is variable.
Meaning my criteria is based on what i key in, in cell C2.
If i key in 10 in cell C2.
my criteria will cap at 10. meaning any numbers i enter in the textbox that is above 10 will return me an error msg.
If i re-enter cell c2 to 20 - it will then change its cap to 20 (value)
is there any way i can do it?
my current formula is:
Public Function Validate()
If TextBox1.Value > worksheets("Sheet1").range("C2").value Then
MsgBox "Error"
Validate = False
Exit Function
End If
Validate = True
End function
However this formula does not work..please advice
I have a question..how do you create a validation in userform?
I have a textbox on the userform..
and this texbox is link to A1 (meaning if i key in a number in the textbox, it will flow to cell A1 of my worksheet).
However i need to input a criteria...and my criteria is variable.
Meaning my criteria is based on what i key in, in cell C2.
If i key in 10 in cell C2.
my criteria will cap at 10. meaning any numbers i enter in the textbox that is above 10 will return me an error msg.
If i re-enter cell c2 to 20 - it will then change its cap to 20 (value)
is there any way i can do it?
my current formula is:
Public Function Validate()
If TextBox1.Value > worksheets("Sheet1").range("C2").value Then
MsgBox "Error"
Validate = False
Exit Function
End If
Validate = True
End function
However this formula does not work..please advice