I'm not much fan of using commands from the "Active" family. Because of this type of problem that may or may not occur.
Do
If Not (IsEmpty(ActiveCell)) Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True
You can substitute for:
Range("D5").End(xldown).offset(1,0)
And so use directly because this is a command and not loop.
Range("D5").End(xldown).offset(1,0).Value = Me.ComboBoxNOME.Value
with Range("D5").End(xldown).offset(1,0)
.Offset(0, 1).Value = Me.TextBoxSALDO.Value * MULTIPLICAR
.Offset(0, 2).Value = Me.TextBoxDEBITO.Value * MULTIPLICAR
.Offset(0, 3).Value = Me.TextBoxGARANTIA.Value * MULTIPLICAR
.Offset(0, 5).Value = Me.TextBoxPLANO.Value * MULTIPLICAR
end with
eur-lex.europa.eu eur-lex.europa.eu = - = - = - = - = - = - = - = - = - = - = - =
- = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - =
- = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - =
[Answering your questions]
"... and this code will not overwrite the data as I open the
form for a second time for example? "
No, this code I mentioned should not overlap anything. Just like the original it searches for the last line and then fills the bottom line with the summary information always goes adc. a new line of data.
"... but it is giving error in this code of yours, something returns me saying that
accurate by o = (equal) The error goes to this line - >
Range ("D5"). End (xldown) .offset (1,0) Could check for me by
favor ... "
Strange that you have given this error could you share the file with sample information for me to take a look at and help? But I noticed that there is a logical error on my part in this code that I passed. In this case:
Range("D5").End(xldown).offset(1,0).Value = Me.ComboBoxNOME.Value
with Range("D5").End(xldown).offset(1,0)
.Offset(0, 1).Value = Me.TextBoxSALDO.Value * MULTIPLICAR
.Offset(0, 2).Value = Me.TextBoxDEBITO.Value * MULTIPLICAR
.Offset(0, 3).Value = Me.TextBoxGARANTIA.Value * MULTIPLICAR
.Offset(0, 5).Value = Me.TextBoxPLANO.Value * MULTIPLICAR
end with
It would be better this way:
with Range("D5").End(xldown).offset(1,0)
.Value = Me.ComboBoxNOME.Value
.Offset(0, 1).Value = Me.TextBoxSALDO.Value * MULTIPLICAR
.Offset(0, 2).Value = Me.TextBoxDEBITO.Value * MULTIPLICAR
.Offset(0, 3).Value = Me.TextBoxGARANTIA.Value * MULTIPLICAR
.Offset(0, 5).Value = Me.TextBoxPLANO.Value * MULTIPLICAR
end with
Note that I took the line of code:
Range("D5").End(xldown).offset(1,0).Value = Me.ComboBoxNOME.Value
And I placed next to With
with Range("D5").End(xldown).offset(1,0)
.Value = Me.ComboBoxNOME.Value 'ESTA LINHA
I tested here as the example below and this "ok"