Supportnet / Forum / Tabellenkalkulation
Excel VBA Übernahme aus Listbox
Frage
Hallo und guten morgen,
ich habe folgendes Problem und komme überhaupt nicht weiter.
Ich habe eine Listbox die schon gefüllt mit Werten ist. Jetzt sollen per Mausclick auf den jeweiligen Eintrag ider Wert n die Tabelle geschrieben werden. Z.B. 1. Eintrag aus listbox anklicken und Wert in A23; nächsten Eintrag aus Listbox anklicken und Wert in A24 usw. so dass alle Werte die angeklickt werden ab A23 untereinander geschrieben werden.
Schon mal ganz vielen Dank
Antwort 1 von Hajo_Zi
Hallo Unbekannter,
Option Explicit
Private Sub ListBox1_Change()
Dim LoLetzte As Long
If ListBox1.Value <> "" Then
' letzte belegte Zeile unabhängig von Excelversion für Spalte A (1)
LoLetzte = IIf(IsEmpty(Cells(Rows.Count, 1)), Cells(Rows.Count, 1).End(xlUp).Row, Rows.Count) + 1
If LoLetzte < 23 Then LoLetzte = 23
Cells(LoLetzte, 1) = ListBox1.Value
End If
End Sub
Gruß Hajo
Option Explicit
Private Sub ListBox1_Change()
Dim LoLetzte As Long
If ListBox1.Value <> "" Then
' letzte belegte Zeile unabhängig von Excelversion für Spalte A (1)
LoLetzte = IIf(IsEmpty(Cells(Rows.Count, 1)), Cells(Rows.Count, 1).End(xlUp).Row, Rows.Count) + 1
If LoLetzte < 23 Then LoLetzte = 23
Cells(LoLetzte, 1) = ListBox1.Value
End If
End Sub
Gruß Hajo

