torquil
05-08-2020, 02:36 PM
Hi everyone,
I am trying to get a userform to automatically disable a command button if the value of a textbox does not apear in a range.
Currently I have the following:
'check if typed client name is a valid client
Dim TypedName As Range
Set TypedName = Sheets("Clients").Range("A:A").Find(What = tbClientName.Value, LookIn:=xlValues, Lookat:=xlWhole)
If Not TypedName Is Nothing Then
cbLoaddata.Enabled = True
Else
cbLoaddata.Enabled = False
End If
This seems only to diable the the button and i cant seem to work out why its the case.
for context I have a textbox wehre user can type in a client name, a dropdown box apears below and they can click on the name or continue to type. but this allows them to type a name that isnt a client and i need to either prevent this and stop them being able to click on the command button on the userform.
ANy pointers ?
I am trying to get a userform to automatically disable a command button if the value of a textbox does not apear in a range.
Currently I have the following:
'check if typed client name is a valid client
Dim TypedName As Range
Set TypedName = Sheets("Clients").Range("A:A").Find(What = tbClientName.Value, LookIn:=xlValues, Lookat:=xlWhole)
If Not TypedName Is Nothing Then
cbLoaddata.Enabled = True
Else
cbLoaddata.Enabled = False
End If
This seems only to diable the the button and i cant seem to work out why its the case.
for context I have a textbox wehre user can type in a client name, a dropdown box apears below and they can click on the name or continue to type. but this allows them to type a name that isnt a client and i need to either prevent this and stop them being able to click on the command button on the userform.
ANy pointers ?