Live-Forum - Die aktuellen Beiträge
Datum
Titel
28.03.2024 21:12:36
28.03.2024 18:31:49
Anzeige
Archiv - Navigation
1260to1264
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

userform_initialize mehrere objekte wg combobox*3

userform_initialize mehrere objekte wg combobox*3
satori
Hallo liebe Leut´
Ich habe kl. Problem :
Folgender Code funzt aber nur solange ich bei einer Combobox bleibe :

Private Sub UserForm_Initialize()
Dim oListe3, oListe1, oListe2
Dim LoI, LoI1, LoI2 As Long
Dim arrListe3, arrListe1, arrListe2 As Long
Set oListe1 = CreateObject("Scripting.dictionary")
Workbooks.Open ("XXX")
With Worksheets("Tabelle1")
For LoI = 5 To Worksheets("Tabelle1").UsedRange.Rows.Count 'To  5600
If Cells(LoI, 2)  "" & Rows(LoI).Hidden = False Then ComboBox1.AddItem Cells(LoI, 2)
oListe1(Cells(LoI, 2).Value) = 0
Next LoI
arrListe1 = oListe1.keys
UserForm4.ComboBox1.List = arrListe1
end with
ChDir ("XXX")
Workbooks("XXX").Close (False)
End Sub


Will ich mehrere (3) like so :

Private Sub UserForm_Initialize()
Dim oListe3, oListe1, oListe2
Dim LoI, LoI1, LoI2 As Long
Dim arrListe3, arrListe1, arrListe2 As Long
Set oListe1 = CreateObject("Scripting.dictionary")
Set oListe2 = CreateObject("Scripting.dictionary")
Set oListe3 = CreateObject("Scripting.dictionary")
Workbooks.Open ("XXX")
With Worksheets("Tabelle1")
For LoI = 5 To Worksheets("Tabelle1").UsedRange.Rows.Count 'To  5600
If Cells(LoI, 2)  "" & Rows(LoI).Hidden = False Then ComboBox1.AddItem Cells(LoI, 2)
oListe1(Cells(LoI, 2).Value) = 0
'If Cells(LoI, 3)  "" & Rows(LoI).Hidden = False Then ComboBox2.AddItem Cells(LoI, 3)
oListe2(Cells(LoI, 3).Value) = 0
'If Cells(LoI, 4)  "" & Rows(LoI).Hidden = False Then ComboBox3.AddItem Cells(LoI, 4)
oListe3(Cells(LoI, 4).Value) = 0
'        End If
Next LoI
arrListe1 = oListe1.keys '& oListe2.keys & oListe3.keys
UserForm4.ComboBox1.List = arrListe1
arrListe2 = oListe2.keys
UserForm4.ComboBox2.List = arrListe2
arrListe3 = oListe3.keys
UserForm4.ComboBox3.List = arrListe3
End With
ChDir ("XXX")
Workbooks("XXX").Close (False)
End Sub


bekomme ich nur Fehlermeldungen.
Wer hat `ne Idee bzw kann mir helfen.
Danke im voraus ...

1
Beitrag zum Forumthread
Beitrag zu diesem Forumthread

Betreff
Benutzer
Anzeige
AW: userform_initialize mehrere objekte wg combobox*3
26.04.2012 14:57:29
Rudi
Hallo,
probier das mal so:
Private Sub UserForm_Initialize()
Dim oListe1 As Object, oListe2 As Object, oListe3 As Object
Dim LoI As Long
Set oListe1 = CreateObject("Scripting.dictionary")
Set oListe2 = CreateObject("Scripting.dictionary")
Set oListe3 = CreateObject("Scripting.dictionary")
Workbooks.Open ("XXX")
With Worksheets("Tabelle1")
For LoI = 5 To .UsedRange.Rows.Count 'To  5600
If .Rows(LoI).Hidden = False Then
If .Cells(LoI, 2)  "" Then
oListe1(.Cells(LoI, 2).Value) = 0
End If
If .Cells(LoI, 3)  "" Then
oListe2(.Cells(LoI, 3).Value) = 0
End If
If .Cells(LoI, 4)  "" Then
oListe3(.Cells(LoI, 4).Value) = 0
End If
End If
Next LoI
End With
ComboBox1.List = oListe1.keys
ComboBox2.List = oListe2.keys
ComboBox3.List = oListe3.keys
ChDir ("XXX")
Workbooks("XXX").Close (False)
End Sub

Gruß
Rudi
Anzeige

301 Forumthreads zu ähnlichen Themen

Anzeige
Anzeige
Anzeige

Links zu Excel-Dialogen

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige