Hi.
In a save button, I need to check if the column "A" worksheet called "FIN" has a value equal to the cell 'I5' worksheet called "Billet"
Then the data will only be saved if the value of 'I5' worksheet called "Billet" do not have in column "A" worksheet called "FIN"
and how to join the code below?
Sub Botão6_Clique()
Dim rCell As Range, iRow As Long
Dim wsBoleto As Worksheet, wsFIN As Worksheet
Set wsBoleto = Worksheets("Boleto")
Set wsFIN = Worksheets("FIN")
With wsFIN
iRow = .Cells(.Rows.Count, 1).End(xlUp).Offset(1, 0).Row
End With
With wsBoleto
For Each rCell In .Range("E16,I7,G9,G13,E19,G19")
If IsEmpty(rCell) Then
MsgBox "Uma ou mais campos estão vazios, favor preencher todos os campos ...", _
vbInformation, "Preenchimento Obrigatório"
Exit Sub
End If
Next rCell
.Range("L7").Value = wsFIN.Cells(iRow, 1).Offset(-1, 0).Value + 1
End With
With wsFIN
.Cells(iRow, 1).Value = wsBoleto.Range("L7").Value
.Cells(iRow, 2).Value = wsBoleto.Range("E16").Value
.Cells(iRow, 3).Value = wsBoleto.Range("I7").Value
.Cells(iRow, 4).Value = wsBoleto.Range("G11").Value
.Cells(iRow, 5).Value = wsBoleto.Range("G9").Value
.Cells(iRow, 6).Value = wsBoleto.Range("G13").Value
.Cells(iRow, 7).Value = wsBoleto.Range("E19").Value
.Cells(iRow, 8).Value = wsBoleto.Range("G19").Value
MsgBox "Os dados foram salvos!!" & vbNewLine & _
"Registro número: " & .Cells(iRow, 1).Value
End With
With wsBoleto
.Range("E16,I7,G9,G13,E19,G19").ClearContents
End With
End Sub
thank you!
Bookmarks