online 1
gast (50)

/ Forum / Tabellenkalkulation

TabellenkalkulationTabellenkalkulation

Fragevon bage vom 10.03.2019, 19:00 Options

UserForm Listbox

Hallo Leute !
Ich brauche mal wieder eure Hilfe.
Ich habe eine UserForm mit einer ListBox,in welcher die Daten aus "Tabelle1"enthalten sind.Beim Aufruf der Tabelle wird die Listbox aktiviert.
Wie muss ich vorgehen wenn ich beim anclicken einer Zeile in der ListBox den Inhalt der gesamten Zeile in "Tabelle2" der aktuellen Arbeitsmappe haben will.
Danke im voraus !
Gerd


Antwort schreiben

Antwort 1 von Hajo_Zi vom 10.03.2019, 20:20 Options

Hallo Gerd,

Private Sub ListBox1_Change()
If ListBox1.Tag <> "" Then Exit Sub
TextBox1 = ListBox1.List(ListBox1.ListIndex, 0)
TextBox2 = ListBox1.List(ListBox1.ListIndex, 1)
TextBox3 = ListBox1.List(ListBox1.ListIndex, 2)
TextBox4 = ListBox1.List(ListBox1.ListIndex, 3)
TextBox5 = ListBox1.List(ListBox1.ListIndex, 4)
TextBox6 = ListBox1.List(ListBox1.ListIndex, 5)
TextBox7 = ListBox1.List(ListBox1.ListIndex, 6)
End Sub

Gruß Hajo

Antwort 2 von Hajo_Zi vom 10.03.2019, 20:21 Options

Hallo Gerd,

anstelle der Textbox natürlich die Zellbezeichnung.

Gruß Hajo

Antwort 3 von bage vom 11.03.2019, 18:46 Options

Hallo Hajo_Zi!
Das ganze funktioniert nicht,bekomme Fehlermeldung
Eigenschaft List kann nicht abgerufen werden
Gerd

Antwort 4 von Beverly vom 11.03.2019, 19:37 Options

Hi Gerd,

versuche es mit diesem Code

    With Worksheets("Tabelle2")
        .Cells(1, 1) = ListBox1.List(ListBox1.ListIndex, 0)
        .Cells(1, 2) = ListBox1.List(ListBox1.ListIndex, 1)
        .Cells(1, 3) = ListBox1.List(ListBox1.ListIndex, 2)
    End With


Bis später,
Karin

Antwort 5 von bage vom 17.03.2019, 22:22 Options

Hallo Karin
Das ganze funktioniert auch so nicht,bekomme weiterhin Fehlermeldung
Eigenschaft List kann nicht abgerufen werden
Mit diesem Code werden die Tabellendaten in die Listbox geladen .

Private Sub UserForm_Initialize()

ListBox1.ColumnCount = 20
'ListenFeld1.SpalteAnzahl = 20
ListBox1.RowSource = "a1:y60"
'ListenFeld1.ZeileQuelle = "a1:y60"
ListBox1.BoundColumn = 0
'ListenFeld1.verbundeneSpalte = 0
'(gebundeneSpalte)
End Sub
Gerd

Antwort 6 von Beverly vom 17.03.2019, 22:34 Options

Hi Gerd,

es ist immer schwierig, eine Arbeitsmappe nachzubauen, weil der Nachbau nie identisch mit dem Original ist. Lade deine Arbeitsmappe doch z.B. unter diesem Link (für 100 Tage) hoch http://uploadagent.de/. Die Linkadresse, die du dort erhältst, kopiere sie in einen Beitrag hier. Dann ist es einfacher, das alles nachzuvollziehen,

Bis später,
Karin

Antwort 7 von bage vom 18.03.2019, 17:41 Options

Hallo Karin
Hier der gewünschte Link
http://www.uploadagent.de/files/1174235989/Kfz- Daten.xls


Gerd

Antwort 8 von Beverly vom 18.03.2019, 19:31 Options

Hi Gerd,

ich habe mal in das Click Ereignis des UserForms Kfz folgenden Code eingefügt:

' neu eingefügter Code für Listbox
Private Sub ListBox1_Click()
    Dim loLetzte As Long
    With Worksheets("Tabelle2")
        loLetzte = IIf(IsEmpty(.Cells(.Rows.Count, 2)), .Cells(.Rows.Count, 2).End(xlUp).Row, .Rows.Count)
        .Cells(loLetzte + 1, 1) = ListBox1.List(ListBox1.ListIndex, 0)
        .Cells(loLetzte + 1, 2) = ListBox1.List(ListBox1.ListIndex, 1)
        .Cells(loLetzte + 1, 3) = ListBox1.List(ListBox1.ListIndex, 2)
        .Cells(loLetzte + 1, 5) = ListBox1.List(ListBox1.ListIndex, 3)
        .Cells(loLetzte + 1, 6) = ListBox1.List(ListBox1.ListIndex, 4)
        .Cells(loLetzte + 1, 7) = ListBox1.List(ListBox1.ListIndex, 5)
        .Cells(loLetzte + 1, 8) = ListBox1.List(ListBox1.ListIndex, 6)
    End With
End Sub


Bei Klick auf eine Zeile der ListBox werden die Werte nach Tabelle2 in die erste freie Zeile übertragen.
Die Zuordnung der Spalten der ListBox zu den einzelnen Spalten der Tabelle2 musst du entsprechend anpassen.

Bis später,
Karin

http://www.uploadagent.de/files/1174242198/RE_Kfz_Daten.xls

Antwort 9 von bage vom 20.03.2019, 21:09 Options

Hallo Karin
Mit dem Ansatz komme ich bestimmt weiter
Danke Gerd

Ähnliche Themen

In Listbox richitgen Eintrag aus DB eintragen
Catze81  22.03.2007 - 97 Hits -

listbox ohne dubletten
schnallgonz  16.05.2007 - 342 Hits - 2 Antworten

ListBox wird nicht aktualisiert
Seradest  04.09.2007 - 58 Hits -

UserForm ListBox
fedjo  15.06.2008 - 166 Hits - 8 Antworten

Hinweis

Diese Frage ist schon etwas älter, Sie können daher nicht mehr auf sie antworten. Sollte Ihre Frage noch nicht gelöst sein, stellen Sie einfach eine neue Frage im Forum..

Neue Einträge

Version: supportware 1.9.150 / 10.06.2022, Startzeit:Thu Jan 8 21:07:44 2026