I'm facing a problem with a function I'm trying to create.
The function should do the following: - Ask for the values - Return True or False if the value exists or not in the B:B column.
This is what I have so far...
Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
Dim Ret As Boolean
Dim FindText As String
If KeyCode = 13 Then
With Sheets("Dados")
Columns("B:B").Select
FindText = TextBox1.Text
Ret = Selection.Find(What:=FindText, After:=.Cells(1, 1), LookIn:=xlValues, LookAt _
:=xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase _
:=False, SearchFormat:=False).Activate
MsgBox "Hy " & FindText & " > " & Ret
If FindText Is Nothing Then Exit Sub
End With
End If End Sub
This works great when the value is true, but gives me the runtime error 91 - Object variable or With block variable not set
if the value is false :(