Página 1 de 1

Forms VBA substituindo a segunda linha

Enviado: 10 Jan 2022 às 07:34
por Guilhermeferreira1
Bom dia pessoal!!
Estou fazendo um forms no VBA para cadastramento e controle de multas, porém quando eu insiro as informações no forms, ele substituí a segunda linha de informações, não consigo novas informações pois ele sempre fica substituindo.
Segue abaixo o código que estou usando:


Private Sub CommandButton1_Click()

linha = Cells(Rows.Count, 1).End(xlUp).Row + 1
Cells(linha, 1) = caixa_placa.Value

If botao_dpo.Value = True Then
Cells(linha, 3) = "DPO"
Else
Cells(linha, 3) = "SPO"
End If

Cells(linha, 2) = Caixacombinacao_status
Cells(linha, 4) = caixa_data.Value
Cells(linha, 5) = caixa_autuacao.Value
Cells(linha, 6) = caixa_autuacaoiden.Value
Cells(linha, 7) = caixa_data_recebimento.Value
Cells(linha, 8) = caixa_operacao.Value
Cells(linha, 9) = caixa_motorista.Value
Cells(linha, 10) = caixa_motivo.Value
Cells(linha, 11) = caixa_local.Value
Cells(linha, 12) = caixa_prazoiden.Value
Cells(linha, 13) = caixa_prazovenc.Value
Cells(linha, 14) = caixa_mdt.Value
Cells(linha, 15) = caixa_obs.Value

Cells(linha, 16) = caixa_valor.Value
Cells(linha, 17) = caixa_valorcobrar.Value

Cells(linha, 18) = caixa_art.Value
Cells(linha, 19) = caixa_pontos.Value


Unload Cadastro_Multas

End Sub

Re: Forms VBA substituindo a segunda linha

Enviado: 10 Jan 2022 às 08:01
por osvaldomp
Substitua o número em vermelho.

de ~~~> linha = Cells(Rows.Count, 1).End(xlUp).Row + 1

para~~~> linha = Cells(Rows.Count, 3).End(xlUp).Row + 1

Re: Forms VBA substituindo a segunda linha

Enviado: 10 Jan 2022 às 08:27
por Guilhermeferreira1
Deu certo, obrigado!!