AW: Daten in Combobox einlesen
27.08.2009 13:39:33
MichaV
Hei,
nö, bin in Norwegen und werd hier noch ne Weile bleiben. Ist schön hier ;o)
Hier mal Hans' Code angepasst auf Deine Bedürfnisse:
Option Explicit
Private Sub CommandButton1_Click()
Dim wbk As Workbook
Dim wks As Worksheet
Dim vRow As Variant
Dim iRow As Integer, iRowT As Integer, iRowL As Integer
Application.ScreenUpdating = False
Set wbk = Workbooks.Open("Mängelliste.xls")
Set wks = wbk.Sheets(1)
iRowL = Cells(Rows.Count, 6).End(xlUp).Row
Workbooks.Add
For iRow = 1 To iRowL
vRow = Application.Match(wks.Cells(iRow, 6).Value, Columns(1), 0)
If IsError(vRow) Then
iRowT = iRowT + 1
Cells(iRowT, 1).Value = wks.Cells(iRow, 6).Value
End If
Next iRow
'Range("A1").CurrentRegion.Sort _
key1:=Range("A1"), order1:=xlAscending, header:=xlNo
With ComboBox1
.List = Range("A1").CurrentRegion.Value
If .ListCount > 0 Then .ListIndex = 0
End With
ActiveWorkbook.Close savechanges:=False
wbk.Close
Set wbk = Nothing
Set wks = Nothing
Application.ScreenUpdating = True
End Sub
Gruß! Micha