andersonps
Mensagens : 1 Data de inscrição : 14/07/2015
| Assunto: erro 13 tipos incopativeis Ter Jul 14, 2015 2:16 am | |
| Boa noite sou novo no forum estou fazendo umas video aula controle de estoque fiz o form de cadastro e no de entrada estou com o seguinte erro quando clico no botão novo ele me da o erro em tempo de execução '13': tipo de dados incompatíveis vou postar o código mas o erro se encontra em cod = textbox3 segue o código abaixo - Código:
-
Private Sub TextBox2_Change()
End Sub
Private Sub TextBox3_Change()
End Sub
Private Sub TextBox3_(ByVal Cancel As MSForms.ReturnBoolean) Dim cod As Single cod = TextBox3 TextBox4 = Application.WorksheetFunction.VLookup(cod, Plan2.Range("A:Z"), 2, 0) End Sub
Private Sub TEXTBOX5_Change()
End Sub
Private Sub CommandButton1_Click()
If TextBox2 = "" Or TextBox3 = "" Or TextBox4 = "" Or TextBox5 = "" Then MsgBox "EXISTEM CAMPOS A SEREM DIGITADOS", vbCritical, "ATENÇÃO" Else
Dim DATA As Date Dim Valor As Single DATA = TextBox2 Valor = TextBox6
If L1 = "NOVO" Then MSG = MsgBox("CONFIRMA A ENTRADA DO PRODUTO?", vbOKCancel, "ATENÇÃO") If MSG = 1 Then
A = Application.WorksheetFunction.CountA(Plan3.Columns(1)) + 1 Plan3.Cells(A, 1) = TextBox1.Text Plan3.Cells(A, 2) = DATA Plan3.Cells(A, 3) = TextBox3 Plan3.Cells(A, 4) = TextBox4 Plan3.Cells(A, 5) = TextBox5.Text Plan3.Cells(A, 6) = Valor CommandButton2_Click MsgBox "ENTRADA REALIZADA COM SUCESSO!!!", vbInformation, "SERVCAMP"
Else End If Else
If L1 = "ALTERAR" Then MS = MsgBox("CONFIRMA A ALTERAÇÃO DO PRODUTO?", vbOKCancel, "ATENÇÃO") If MS = 1 Then
Dim CORR As Single CORR = TextBox1 B = Application.WorksheetFunction.Match(CORR, Plan3.Columns(1), 0) Plan3.Cells(B, 2) = DATA Plan3.Cells(B, 3) = TextBox3 Plan3.Cells(B, 4) = TextBox4 Plan3.Cells(B, 5) = TextBox5.Text Plan3.Cells(B, 6) = Valor CommandButton2_Click Else End If End If End If End If
End Sub
Private Sub CommandButton2_Click() TextBox1 = "" TextBox2 = "" TextBox3 = "" TextBox4 = "" TextBox5 = "" TextBox6 = "" TextBox1.Enabled = False TextBox2.Enabled = False TextBox3.Enabled = False TextBox4.Enabled = False TextBox5.Enabled = False TextBox6.Enabled = False
CommandButton3.Enabled = True CommandButton4.Enabled = True CommandButton5.Enabled = True CommandButton6.Enabled = True CommandButton1.Enabled = False CommandButton2.Enabled = False
End Sub
Private Sub CommandButton3_Click() L1 = "NOVO" TextBox1 = WorksheetFunction.Max(Plan3.Columns(1)) + 1 TextBox2.Enabled = True TextBox3.Enabled = True TextBox4.Enabled = True TextBox5.Enabled = True TextBox6.Enabled = True
TextBox2 = Date TextBox3 = "" TextBox4 = "" TextBox5 = "" TextBox6 = "" CommandButton3.Enabled = False CommandButton4.Enabled = False CommandButton5.Enabled = False CommandButton6.Enabled = False CommandButton1.Enabled = True CommandButton2.Enabled = True End Sub
Private Sub CommandButton4_Click() L1 = "ALTERAR" TextBox1.Enabled = True CommandButton3.Enabled = False CommandButton4.Enabled = False CommandButton5.Enabled = False CommandButton6.Enabled = False CommandButton1.Enabled = True CommandButton2.Enabled = True
End Sub
Private Sub CommandButton5_Click() L1 = "CONSULTAR" TextBox1.Enabled = True CommandButton3.Enabled = False CommandButton4.Enabled = False CommandButton5.Enabled = False CommandButton6.Enabled = False CommandButton1.Enabled = True CommandButton2.Enabled = True End Sub
Private Sub CommandButton6_Click() L1 = "EXCLUIR" TextBox1.Enabled = True CommandButton3.Enabled = False CommandButton4.Enabled = False CommandButton5.Enabled = False CommandButton6.Enabled = False CommandButton1.Enabled = True CommandButton2.Enabled = True End Sub
Private Sub Label1_Click()
End Sub
Private Sub Label6_Click()
End Sub
Private Sub TEXTBOX1_Change() End Sub
Private Sub TEXTBOX1_(ByVal Cancel As MSForms.ReturnBoolean) On Error GoTo trata
Dim cod As Single cod = TextBox1 TextBox2 = Application.WorksheetFunction.VLookup(cod, Plan3.Range("a:z"), 2, 0) TextBox3 = Application.WorksheetFunction.VLookup(cod, Plan3.Range("a:z"), 3, 0) TextBox4 = Application.WorksheetFunction.VLookup(cod, Plan3.Range("a:z"), 4, 0) TextBox5 = Application.WorksheetFunction.VLookup(cod, Plan3.Range("a:z"), 5, 0) TextBox6 = Application.WorksheetFunction.VLookup(cod, Plan3.Range("a:z"), 6, 0) TextBox6 = Format(TextBox6, "R$ #,##0.00") TextBox2 = Format(TextBox2, "dd/mm/yyyy") If L1 = "CONSULTAR" Then TextBox1.Enabled = False Else If L1 = "ALTERAR" Then TextBox1.Enabled = False TextBox2.Enabled = True TextBox3.Enabled = True TextBox4.Enabled = True TextBox5.Enabled = True TextBox6.Enabled = True Else If L1 = "EXCLUIR" Then MSG = MsgBox("CONFIRMA A EXCLUSÃO DO PRODUTO?", vbOKCancel, "ATENÇÃO") If MSG = 1 Then Dim CORR As Single CORR = TextBox1 B = Application.WorksheetFunction.Match(CORR, Plan3.Columns(1), 0) Plan3.Rows(2).Delete Shift:=xlUp Plan3.Rows(B).Delete Shift:=xlUp CommandButton2_Click Else
End If End If End If End If 'Sub trata: MsgBox "Produto não Cadastrado", vbInformation, "ServCamp"
End Sub
Private Sub TEXTBOX4_Change()
End Sub
Private Sub TEXTBOX4_(ByVal Cancel As MSForms.ReturnBoolean) TextBox4 = Format(TextBox4, "R$ #,##0.00")
End Sub
Private Sub TextBox5_Exit(ByVal Cancel As MSForms.ReturnBoolean) Dim cod As Single cod = TextBox3 TextBox6 = Application.WorksheetFunction.VLookup(cod, Plan2.Range("A:Z"), 4, 0) * TextBox5
End Sub
Private Sub TextBox6_Change()
End Sub
Private Sub UserForm_Click()
End Sub
Private Sub UserForm_Initialize()
End Sub
| |
|
alexandrevba
Mensagens : 1820 Data de inscrição : 13/07/2011 Localização : Serra - ES
| Assunto: Re: erro 13 tipos incopativeis Ter Jul 14, 2015 8:43 pm | |
| Boa tarde!!
Respondido em: http://www.planilhando.com.br/forum/viewtopic.php?f=10&t=16588 Att | |
|