I've run into another problem in my vba project, when i insert a value in my form, it searches where that number is on column 1 and returns the values from the same row on column 3 and 12 to the form. When i fill the form and press enter it shows this error:
"Run-time error '-2147352571 (80020005)':
Could not set value property. Type mismatch."
Bellow is the code:
The line where the debuger stays is:
Thanks.
"Run-time error '-2147352571 (80020005)':
Could not set value property. Type mismatch."
Bellow is the code:
VBA Code:
Private Sub txtdevolução_AfterUpdate()
Dim id As String, rowcount As Integer, foundcell As Range
id = txtdevolução.Value
rowcount = thisworkbook.Sheets("retornos pendentes").Cells(Rows.Count, 1).End(xlUp).Row
With thisworkbook.Worksheets("retornos pendentes").Range("A1:A" & rowcount)
Set foundcell = .Find(what:=id, LookIn:=xlValues, lookat:=xlWhole)
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
The line where the debuger stays is:
txtclienteopl.Value = .Cells(foundcell.Row, 3)
Thanks.