Artigo VBA- Problemas com o botão guardar

Boas,

Substitui o código do botão por este: (o erro era no cálculo da posição da linha, que dava um valor inválido)

Sheets("Dados").Select

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


Cells(linha, 1) = TextBox_tipo.Value

Cells(linha, 2) = TextBox_serialn.Value

Cells(linha, 3) = TextBox_nomem.Value

Cells(linha, 4) = TextBox_nanu.Value

Cells(linha, 5) = TextBox_model.Value

Cells(linha, 6) = TextBox_so.Value

Cells(linha, 7) = TextBox_anoinst.Value

Cells(linha, 8) = TextBox_office.Value

Cells(linha, 9) = TextBox_ram.Value

Cells(linha, 10) = TextBox_anoaqui.Value

Cells(linha, 11) = TextBox_imof.Value

Cells(linha, 12) = TextBox_monitor.Value

Cells(linha, 13) = TextBox_monitorm.Value

Cells(linha, 14) = TextBox_ifm.Value


If OptionButton3.Value = True Then
Cells(linha, 15) = "Sim"

Else
Cells(linha, 15) = "Não"
End If


Cells(linha, 16) = TextBox_atrib.Value

Cells(linha, 17) = TextBox_login.Value

Cells(linha, 18) = TextBox_edificio.Value

Cells(linha, 19) = TextBox_departamento.Value

Cells(linha, 20) = TextBox_obs.Value

Sheets("Comandos").Select
 
Back
Topo