Grizlore
Active Member
- Joined
- Aug 22, 2006
- Messages
- 259
I am looking for some help please, I am sure it is something simple.
When I enter a numerical value into the Userform textbox "txtRTAs" I would like it to look at a worksheet to see if the number is there. IF it is, then I want a simple MsgBox to inform that this number is there and "banned"
The code works for letters, but not for numberical values. I guess it is something simple, but it is rather frustrating as I cant fathom it out.
Any help would be greatly appreciated! The code below is the small section which isn't working
When I enter a numerical value into the Userform textbox "txtRTAs" I would like it to look at a worksheet to see if the number is there. IF it is, then I want a simple MsgBox to inform that this number is there and "banned"
The code works for letters, but not for numberical values. I guess it is something simple, but it is rather frustrating as I cant fathom it out.
Any help would be greatly appreciated! The code below is the small section which isn't working
VBA Code:
Sub IsItBANNED()
Dim LookUpIfBanned 'as I have tried several
LookUpIfBanned = txtRTAs
If Not IsError(Application.VLookup(txtRTAs, Worksheets("banned").Range("TheseAreBanned"), 2, False)) Then
MsgBox "this is banned", vbCritical, "BANNED ALERT"
End If
End Sub