Página 1 de 1

AJUDA VBA

Enviado: 07 Fev 2019 às 11:00
por LIVYWODIANER
Boa Tarde, estou criando uma planilha em VBA de lançamento de pedido e embalagens.

Preciso de uma função que ative o código salvar após inserir texto no txtsku1 e pressionar enter.

Private Sub btnSALVAR_Click()

Dim linha As Integer

Set result = Sheets("EMBALAGEM").Range("B1:B400").Find(txtsku1.Value, lookat:=xlWhole)
If result Is Nothing Then
MsgBox "EMBALAGEM NÃO CADASTRADA"
txtsku1.Value = ""
Txtpedido.Value = ""

Txtpedido.SetFocus

Exit Sub

End If

linha = Sheets("AuxLanc").Range("B2").Value
With Sheets("LANCAMENTO")
.Range("A" & linha).Value = linha
.Range("B" & linha).Value = frmLANCAMENTO.Txtpedido.Text
.Range("C" & linha).Value = frmLANCAMENTO.txtsku1.Text
End With

Sheets("AuxLanc").Range("B2").Value = linha + 1


Call LIMPAR2

End Sub

AJUDA VBA

Enviado: 08 Fev 2019 às 18:20
por mprudencio
Nao vi a planilha.

Estou supondo que txtsku1 é uma textbox em um formulario

Experimente assim:

If txtsku1.value = "" Then
MsgBox "EMBALAGEM NÃO CADASTRADA"
Exit sub
End if


Coloque no inicio do codigo.