Live-Forum - Die aktuellen Beiträge
Datum
Titel
24.04.2024 19:29:30
24.04.2024 18:49:56
Anzeige
Archiv - Navigation
1112to1116
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
Inhaltsverzeichnis

Fehler bei UF ListBox Column Eigenschaft

Fehler bei UF ListBox Column Eigenschaft
Josef
Hallo!
Ich möchte erreichen, dass in der ListBox1 die spalten in Abhängigkeit der Listbox2 befüllt werden.
Leider bekomme ich den Fehler Eigenschaft Column konnte nicht gesetzt werden.
Was müßte ich bitte am Code ändern , damit alles funktioniert.
Private Sub ListBox1_befüllen()
Dim wks As Worksheet
Set wks = Workbooks("Masterfile.xls").Worksheets("Tabelle1")
With ListBox1
'      .Clear                           ' löschen ComboBox
.ColumnCount = 7                 ' drei Spalten
.ColumnWidths = "1,8 cm;1,9 cm;16 cm;1,8 cm;1,8 cm" ' Breite der Spalten
' .ListRows = 12                   ' angezeigte Zeilen
'.Height = 20                     ' Höhe der ComboBox
'.Font.Size = 8                  ' Schriftgröße
' .BackColor = RGB(204, 255, 204)  ' Hintergrundfarbe
End With
ListBox1.Column(0) = wks.Cells(ListBox2.ListIndex + 1, 3)
ListBox1.Column(1) = wks.Cells(ListBox2.ListIndex + 1, 27)
ListBox1.Column(2) = wks.Cells(ListBox2.ListIndex + 1, 28)
ListBox1.Column(3) = wks.Cells(ListBox2.ListIndex + 1, 106)
ListBox1.Column(4) = wks.Cells(ListBox2.ListIndex + 1, 105)
End Sub

Danke
Josef

2
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Benutzer
Anzeige
AW: Fehler bei UF ListBox Column Eigenschaft
28.10.2009 13:38:30
Chris
Servus Josef,
ich würde die Listbox mal so befüllen:
ListBox1.AddItem wks.Cells(ListBox2.ListIndex + 1, 3)
ListBox1.List(ListBox1.ListCount -1, 1) = wks.Cells(ListBox2.ListIndex + 1, 27)
ListBox1.List(ListBox1.ListCount -1, 2) = wks.Cells(ListBox2.ListIndex + 1, 28)
ListBox1.List(ListBox1.ListCount -1, 3) = wks.Cells(ListBox2.ListIndex + 1, 106)
ListBox1.List(ListBox1.ListCount -1, 4) = wks.Cells(ListBox2.ListIndex + 1, 105)
u.s.w bis ListBox1.List(ListBox1.ListCount -1, 6), dann sind deine sieben Spalten gefüllt.
Gruß
Chris
AW: Fehler bei UF ListBox Column Eigenschaft
28.10.2009 14:37:33
Josef
Hallo Chris!
Danke für Deine Antwort und Deine Lösung. Würde beinahe alles passen.
Habe folgenden Code genommen und die ListBox2 und eine ComboBox umgeändert.
Private Sub CommandButton5_Click()
Dim wks As Worksheet
Set wks = Workbooks("Masterfile.xls").Worksheets("Tabelle1")
With ListBox1
'      .Clear                           ' löschen ComboBox
.ColumnCount = 7                 ' drei Spalten
.ColumnWidths = "1,8 cm;1,9 cm;16 cm;1,8 cm;1,8 cm" ' Breite der Spalten
' .ListRows = 12                   ' angezeigte Zeilen
'.Height = 20                     ' Höhe der ComboBox
'.Font.Size = 8                  ' Schriftgröße
' .BackColor = RGB(204, 255, 204)  ' Hintergrundfarbe
End With
ListBox1.AddItem wks.Cells(cboListe1.ListIndex + 1, 3)
ListBox1.List(ListBox1.ListCount - 1, 1) = wks.Cells(cboListe1.ListIndex + 1, 27)
ListBox1.List(ListBox1.ListCount - 1, 2) = wks.Cells(cboListe1.ListIndex + 1, 28)
ListBox1.List(ListBox1.ListCount - 1, 3) = wks.Cells(cboListe1.ListIndex + 1, 106)
ListBox1.List(ListBox1.ListCount - 1, 4) = wks.Cells(cboListe1.ListIndex + 1, 105)
'Call ListBox1_befüllen
End Sub
Leider wird manchmal der Wert doppelt eingetragen, ansonsten immer um eine Zeile versetzt.
Die ComboBox wird wie folgt gefüllt:
Private Sub OptionButton1_Click()
cboListe1.RowSource = "Tabelle1!AB2:AB" & IIf(IsEmpty(Cells(Rows.Count, 1)), _
Cells(Rows.Count, 1).End(xlUp).Row, Rows.Count)
OptionButton2.Value = False
End Sub

Danke
Anzeige

Links zu Excel-Dialogen

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige