AW: ComboBox befüllen
20.03.2010 09:58:05
ransi
HAllo
Nehmen wir mal an deine Daten sind so organisiert:
Tabelle1
| | A | B | C |
| 1 | Müller | vorname8 | |
| 2 | Schmidt | vorname8 | |
| 3 | Schneider | vorname8 | |
| 4 | Fischer | vorname8 | |
| 5 | Meyer | vorname5 | |
| 6 | Weber | vorname3 | |
| 7 | Wagner | vorname6 | |
| 8 | Becker | vorname7 | |
| 9 | Schulz | vorname8 | |
| 10 | Hoffmann | vorname7 | |
| 11 | Müller | vorname1 | |
| 12 | Schmidt | vorname4 | |
| 13 | Schneider | vorname5 | |
| 14 | Fischer | vorname1 | |
| 15 | Meyer | vorname5 | |
| 16 | Weber | vorname8 | |
| 17 | Wagner | vorname9 | |
| 18 | Becker | vorname8 | |
| 19 | Schulz | vorname2 | |
| 20 | Hoffmann | vorname5 | |
| 21 | Müller | vorname6 | |
| 22 | Schmidt | vorname3 | |
| 23 | Schneider | vorname2 | |
| 24 | Fischer | vorname5 | |
| 25 | Meyer | vorname2 | |
| 26 | Weber | vorname5 | |
| 27 | Wagner | vorname6 | |
| 28 | Becker | vorname5 | |
| 29 | Schulz | vorname4 | |
| 30 | Hoffmann | vorname0 | |
| 31 | Müller | vorname1 | |
| 32 | Schmidt | vorname6 | |
| 33 | Schneider | vorname0 | |
| 34 | Fischer | vorname5 | |
| 35 | Meyer | vorname6 | |
| 36 | Weber | vorname7 | |
| 37 | | | |
Excel Tabellen im Web darstellen >> Excel Jeanie HTML 4
Jetzt hast du eine Userform :Userform1
DArauf die ComboBoxen :ComboBox1 ,ComboBox2.
JEtzt ganz einfach so:
' **********************************************************************
' Modul: UserForm1 Typ: Userform
' **********************************************************************
Option Explicit
Dim Arr As Variant
Dim MyDic As Object
Private Sub UserForm_Initialize()
Dim L As Long
Set MyDic = Nothing
Arr = Sheets("Tabelle1").Range("a1").CurrentRegion
Set MyDic = CreateObject("Scripting.Dictionary")
For L = 1 To UBound(Arr)
MyDic(Arr(L, 1)) = 0
Next
ComboBox1.List = MyDic.keys
MyDic.removeall
End Sub
Private Sub ComboBox1_Change()
ComboBox2.Clear
Dim L As Long
For L = 1 To UBound(Arr)
If Arr(L, 1) = ComboBox1.Value Then MyDic(Arr(L, 2)) = 0
Next
ComboBox2.List = MyDic.keys
MyDic.removeall
End Sub
ransi