wie kann ich eine Spalte nach Nachnamen sortieren, obwohl zuerst der abgekürzte Vorname in den Zellen steht?
z.B. so sehen meine Einträge aus:
H. Oberle
Ti. Müller
G. Gerstner
Sch. Kastner
usw.
Vielen Dank im voraus.
Gruß Helmut
Sub TextNurNachLeerzeichen()
Dim rng As Range
For Each rng In Selection
With rng
.Value = Right$(.Value, Len(.Value) - InStr(1, .Value, " "))
End With
Next
End Sub
War´s das?
Gruß
Roland Hochhäuser
Sub Sortiere()
Dim Bereich As Range
Set Bereich = Range("A2", Cells(Rows.Count, 1).End(xlUp)). _
Offset(0, Columns.Count - 1)
Bereich.FormulaR1C1 = _
"=IF(ISERROR(FIND("" "",RC1)),IF(ISERROR(FIND" & _
"(""."",RC1)),"""",RIGHT(RC1,LEN(RC1)-FIND(""."",RC1)" & _
")),RIGHT(RC1,LEN(RC1)-FIND("" "",RC1)))"
Range("2:" & Cells(Rows.Count, 1).End(xlUp).Row).Sort _
Key1:=Cells(2, Columns.Count), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Bereich.ClearContents
Set Bereich = Nothing
End Sub
Gruß Tino
Sub Sortiere()
Dim Bereich As Range
Set Bereich = Range("B2", Cells(Rows.Count, 2).End(xlUp)). _
Offset(0, Columns.Count - 2)
Bereich.FormulaR1C1 = _
"=IF(ISERROR(FIND("" "",RC2)),IF(ISERROR(FIND(""."",RC2)),""""," & _
"RIGHT(RC2,LEN(RC2)-FIND(""."",RC2))),RIGHT(RC2,LEN(RC2)-FIND("" "",RC2)))"
Range("2:" & Cells(Rows.Count, 1).End(xlUp).Row).Sort _
Key1:=Cells(2, Columns.Count), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Bereich.ClearContents
Set Bereich = Nothing
End Sub
Bin jetzt auf einer Party, bin erst morgen wieder Online.
Bei Problemen, kann bestimmt auch ein anderer aushelfen.
Gruß Tino
Sub Sortiere()
Dim Bereich As Range
Set Bereich = Range("B2", Cells(Rows.Count, 2).End(xlUp)). _
Offset(0, Columns.Count - 2)
Bereich.FormulaR1C1 = _
"=IF(ISERROR(FIND("" "",RC2)),IF(ISERROR(FIND(""."",RC2)),""""," & _
"RIGHT(RC2,LEN(RC2)-FIND(""."",RC2))),RIGHT(RC2,LEN(RC2)-FIND("" "",RC2)))"
Range("2:" & Cells(Rows.Count, 2).End(xlUp).Row).Sort _
Key1:=Cells(2, Columns.Count), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Bereich.ClearContents
Set Bereich = Nothing
End Sub
Gruß Tino