I want to auto fill two textboxes on my userform ,from a data of a sheet i have, but i want the code to find with the exact value and not just one part of it.
Ex: if i put the number "33" it returns a value, when the column have like "202409334", i want to assume a value only when the entire number is filled.
Private Sub txtdevolução_AfterUpdate()
Dim id As String, rowcount As Integer, foundcell As Range
id = txtdevolução.Value
rowcount = Sheets("retornos pendentes").Cells(Rows.Count, 1).End(xlUp).Row
With Worksheets("retornos pendentes").Range("A1:A" & rowcount)
Set foundcell = .Find(what:=id, LookIn:=xlValues)
If Not foundcell Is Nothing Then
txtclienteopl.Value = .Cells(foundcell.Row, 3)
txtmatricula2.Value = .Cells(foundcell.Row, 12)
Else
txtclienteopl.Value = ""
txtmatricula2.Value = ""
End If
End With
End Sub