AW: Namenszusätze an den Anfang stellen
23.11.2007 16:04:00
Wolli
Hallo Jürgen, auf dass Dir dieses Makro helfen möge! Es berücksichtigt aber nur Deine 4 Fälle und läuft von Zeile 1 abwärts, bis es auf eine leere Zelle stößt. Namen ohne Adel werden ignoriert.
Gruß + schönes WE, Wolli
Option Explicit
Sub Voradeln()
Dim x As Long
Cells(1, 1).Select
Do
x = InStr(1, UCase(ActiveCell), " VAN DE ")
If x > 0 Then
ActiveCell = "Van De " & Left(ActiveCell, x - 1) & _
Right(ActiveCell, Len(ActiveCell) - x - 6)
Else
x = InStr(1, UCase(ActiveCell), " VAN ")
If x > 0 Then
ActiveCell = "Van " & Left(ActiveCell, x - 1) & _
Right(ActiveCell, Len(ActiveCell) - x - 3)
End If
End If
x = InStr(1, UCase(ActiveCell), " VON DER ")
If x > 0 Then
ActiveCell = "Von Der " & Left(ActiveCell, x - 1) & _
Right(ActiveCell, Len(ActiveCell) - x - 7)
Else
x = InStr(1, UCase(ActiveCell), " VON ")
If x > 0 Then
ActiveCell = "Von " & Left(ActiveCell, x - 1) & _
Right(ActiveCell, Len(ActiveCell) - x - 3)
End If
End If
ActiveCell.Offset(1, 0).Select
Loop Until ActiveCell = ""
End Sub