Gruppe
Allgemein
Problem
Wie kann ich eine Adressliste, die jeweils in der ersten Zeile den Namen, in der Zweiten die Straße und in der Dritten den Ort beinhaltet, alphabetisch nach den Namen sortieren lassen?
StandardModule: basMain
Sub Sortieren()
Dim lRow As Long
Dim iCol As Integer, iRow As Integer
Application.ScreenUpdating = False
lRow = 1
iCol = 1
Do Until IsEmpty(Cells(lRow, 1))
iCol = iCol + 1
If iCol = 5 Then iCol = 2
Cells(CInt((lRow + 1) / 3), iCol) = Cells(lRow, 1)
lRow = lRow + 1
Loop
Columns("B:D").Sort key1:=Range("B1"), order1:=xlAscending, header:=xlNo
iRow = 1
lRow = 1
Do Until IsEmpty(Cells(iRow, 2))
For iCol = 2 To 4
Cells(lRow, 1) = Cells(iRow, iCol)
lRow = lRow + 1
Next iCol
iRow = iRow + 1
Loop
Columns("B:D").ClearContents
Application.ScreenUpdating = True
End Sub