-2
Hello, I’m trying to learn Excel vba to help my father in his company, I use the version of excel 2016, in the code I built following the course, it was time to enter the product code, it shows the manufacturer, number and part name, But he only recognizes the first line of the spreadsheet where the products are, I hope you help me, I thank you already! Code:
Private Sub Btnconsultar_Click()
Dim EmpFound As Range
With Range("Códigos_valv")
Set EmpFound = .Find(Me.Txt_cod.Value)
If EmpFound Is Nothing Then
MsgBox "Válvula não encontrada", vbCritical, "Consultar válvula"
Me.Txt_cod.Value = ""
Else
With Range(EmpFound.Address)
Me.Txt_numero = .Offset(0, 1)
Me.Txt_nomeval = .Offset(0, 2)
Me.Txt_fabri = .Offset(0, 3)
On Error Resume Next
Me.Ifoto1.Picture = LoadPicture("C:\Users\Usuario\Desktop\RRG Type\para converter\Imagens para cadastro\Imagens válvulas\" & EmpFound & ".jpg")
On Error GoTo 0
End With
End If
End With
Set EmpFound = Nothing
End Sub