Uma família de softwares de planilhas da Microsoft com ferramentas para analisar, criar gráficos e comunicar dados
Esta resposta foi traduzida automaticamente. Como resultado, pode haver erros gramaticais ou palavras estranhas.
Olá AdrianoPaulo,
Para manter os valores inseridos, incorpore um Selecionar... Declaração do caso.
Espero que isso ajude:
Private Sub btnExportar_ClicK()
Sheets("Com").Select
Linha = Range("B100000").End(xlUp).Row + 1
Cells(Linha, 2) = DateValue(txtdata.Value) ' 1
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 ' 2
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
Dim objeto As Control
For Each objeto In Me.Controls
If TypeName(objeto) = "TextBox" Or TypeName(objeto) = "ComboBox" Then
Select Case objeto.Name
' /* Keep the values you have entered. */
Case "txtdata", "ComboBox1", "Fatura"
' Do nothing here.
Case Else
objeto.Text = ""
End Select
End If
Next
End If
End Sub