Kód: Vybrat vše
Private Sub CommandButton1_Click()
Dim PoslBunka As Range
' nalezeni posledniho neprazdneho radku na listu:
' nastaveni na posledni radek listu ve sloupci
Set PoslBunka = Worksheets("7").Range("A:A").Cells(Range("A:A").Cells.Count)
' presun na posledni neprazny radek listu
If IsEmpty(PoslBunka) Then Set PoslBunka = PoslBunka.End(xlUp)
'nastaveni na prazdnou bunku
Set PoslBunka = PoslBunka.Offset(1, 0)
' vlozeni dat z textovych poli formulare do listu
PoslBunka.Value = UserForm1.TextBox1
PoslBunka.Value = UserForm1.vodic1
PoslBunka.Value = UserForm1.km1
PoslBunka.Value = UserForm1.pret1
PoslBunka.Value = UserForm1.cer1
PoslBunka.Value = UserForm1.tankcs1
PoslBunka.Value = UserForm1.tanksklad1
PoslBunka.Value = UserForm1.rano1
PoslBunka.Value = UserForm1.druh1
PoslBunka.Value = UserForm1.TextBox2
PoslBunka.Offset(0, 0).Value = UserForm1.TextBox1
PoslBunka.Offset(0, 1).Value = UserForm1.vodic1
PoslBunka.Offset(0, 2).Value = UserForm1.km1
PoslBunka.Offset(0, 3).Value = UserForm1.pret1
PoslBunka.Offset(0, 4).Value = UserForm1.cer1
PoslBunka.Offset(0, 5).Value = UserForm1.tankcs1
PoslBunka.Offset(0, 6).Value = UserForm1.tanksklad1
PoslBunka.Offset(0, 7).Value = UserForm1.rano1
PoslBunka.Offset(0, 8).Value = UserForm1.druh1
PoslBunka.Offset(0, 9).Value = UserForm1.TextBox2
'vyprazdnit textova pole
UserForm1.TextBox1.Value = vbNullString
UserForm1.vodic1.Value = vbNullString
UserForm1.km1.Value = vbNullString
UserForm1.pret1.Value = vbNullString
UserForm1.cer1.Value = vbNullString
UserForm1.tankcs1.Value = vbNullString
UserForm1.tanksklad1.Value = vbNullString
UserForm1.rano1.Value = vbNullString
UserForm1.druh1.Value = vbNullString
UserForm1.TextBox2.Value = vbNullString
End Sub
Vďaka za rady