stillwillyboy
Technical User
I am wanting to use VLookup during the process of data entry to verify that a record exists. I have tried the following but it always goes to the MsgBox. I have verified that the client number that I am entering does exist on the sheet ClntInfo in the named range ClientInfoAll. What am I missing. Thanks, Bill
If Len(ClientEntry) = 4 And IsNumeric(ClientEntry) _
And ClientEntry >= 1000 And ClientEntry <= 2999 And _
ClientEntry = "=VLookup(ClientEntry, clntinfo!clientinfoall, 1, False)" Then
ValidEntry1 = True
Range("A65536").End(xlUp).Offset(1, 0) = ClientEntry
Else
MsgBox "Invalid Client Number. Either not 4 digits, " _
& "not in range between 1000 and 2999 or no record for this client."
ClientEntry = ""
End If
End If
If Len(ClientEntry) = 4 And IsNumeric(ClientEntry) _
And ClientEntry >= 1000 And ClientEntry <= 2999 And _
ClientEntry = "=VLookup(ClientEntry, clntinfo!clientinfoall, 1, False)" Then
ValidEntry1 = True
Range("A65536").End(xlUp).Offset(1, 0) = ClientEntry
Else
MsgBox "Invalid Client Number. Either not 4 digits, " _
& "not in range between 1000 and 2999 or no record for this client."
ClientEntry = ""
End If
End If