1
I am making a form and I want the person to register only 6x (only 6 lines) the content. How to limit this amount ?
As an example above, I put the rows and columns and when I fill in the form, new numbers go down
Private Sub CmdSalvar_Click()
Dim Linha As Integer
'Valor inicial da Variável Linha
Linha = 85
**Do Until ThisWorkbook.Sheets("CADASTRO").Cells(Linha, 8).Value = Empty
Linha = Linha + 1**
Loop
'SE o usuário não entrar com os dados
If TxtMes.Value = Empty Or TxtAno.Value = Empty Then
ElseIf TxtLeitura.Value = Empty Or TxtConsumo.Value = Empty Then
MsgBox ("Preencha todos os dados!")
Else
ThisWorkbook.Sheets("CADASTRO").Cells(Linha, 8).Value = TxtMes.Value
ThisWorkbook.Sheets("CADASTRO").Cells(Linha, 9).Value = TxtAno.Value
ThisWorkbook.Sheets("CADASTRO").Cells(Linha, 11).Value = TxtLeitura.Value
ThisWorkbook.Sheets("CADASTRO").Cells(Linha, 14).Value = TxtConsumo.Value
End If
End Sub
I believe it is because of the following lines:
**Do Until ThisWorkbook.Sheets("CADASTRO").Cells(Linha, 8).Value = Empty
Linha = Linha + 1**
But how to change to stop the fill on line 90 ? (Starts on line 85 and I want to stop at 90)