AdrianoPaulo Posted January 14, 2025 at 05:16 PM Report #634353 Posted January 14, 2025 at 05:16 PM Boas Tardes Tenho um codigo em vba que necessito que ele deixe 3 caixas do formulario com os dados anteriores, deixo aqui ate onde consegui chegar: Private Sub btnExportar_ClicK() Sheets("Com").Select Linha = Range("B100000").End(xlUp).Row + 1 Cells(Linha, 2) = DateValue(txtdata.Value) Cells(Linha, 3) = txtpecas.Value Cells(Linha, 4) = txtdescricao.Value Cells(Linha, 5) = txtrefcliente.Value Cells(Linha, 6) = TextBox1.Value Cells(Linha, 12) = ComboBox1.Value Cells(Linha, 11) = Fatura.Value Cells(Linha, 10) = txtqtde.Value Cells(Linha, 7) = txtnoks.Value Cells(Linha, 8) = hinicio.Value Cells(Linha, 9) = hfim.Value MsgBox "Registro Inserido", 6, "Inserir" resposta = MsgBox("Novo Registro?", 36, "Inserir") If resposta = vbYes Then 'txtdata = "" txtpecas = "" txtdescricao = "" txtrefcliente = "" TextBox1 = "" 'ComboBox1 = "" 'Fatura = "" txtqtde = "" txtnoks = "" hinicio = "" hfim = "" txtdescricao = "" txtrefcliente = "" txtdata.SetFocus End If If resposta = vbNo Then 'txtdata = "" txtpecas = "" txtdescricao = "" txtrefcliente = "" TextBox1 = "" 'ComboBox1 = "" 'Fatura = "" txtqtde = "" txtnoks = "" hinicio = "" hfim = "" txtdescricao = "" txtrefcliente = "" txtobs = "" TxtPausas = "" Else Dim objeto As Control For Each objeto In Me.Controls If TypeName(objeto) = "TextBox" Or TypeName(objeto) = "ComboBox" Then objeto.Text = "" End If Next objeto End If End Sub Pretendo que o txtdat, Combobox1 e Fatura fiquem com os valores ja introduzidos. Porque esta a limpar tudo. Obrigado pela ajuda
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now