Silva,
teste agora novamente.
Qual erro surge para você ao Salvar?
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim ws As Worksheet
Set ws = Sheets("Cad_Mat")
If TextBox1 = "" Then
Exit Sub
End If
On Error GoTo ErroMAT:
lin = Application.WorksheetFunction.Match(CInt(TextBox1.Value), ws.Range("A:A"), 0)
TextBox2 = ws.Cells(lin, 2)
Exit Sub
ErroMAT:
TextBox1 = ""
TextBox2 = ""
MsgBox ("Código de Material inválido")
End Sub
Private Sub TextBox3_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim ws As Worksheet
Set ws = Sheets("Cad_Setor")
If TextBox3 = "" Then
Exit Sub
End If
On Error GoTo ErroSET:
lin = Application.WorksheetFunction.Match(CInt(TextBox3.Value), ws.Range("A:A"), 0)
TextBox4 = ws.Cells(lin, 2)
Exit Sub
ErroSET:
TextBox3 = ""
TextBox4 = ""
MsgBox ("Código de Setor inválido")
End Sub
Existem mil maneiras de preparar Neston. Invente a sua!
http://www.youtube.com/ExpressoExcel
Postado : 03/07/2011 4:04 pm