Syntaxfrage zu Replace
Jörg-HH
mit dem kleinen Schnipsel hier wollte ich Namen ändern, wenn es denn zuviele sind für Handarbeit. Warum wird die Replace-Zeile rot bemeckert?
Sub NamenÄndern()
Dim nm As Name
Dim nmAlt As Name
Dim nmNeu As Name
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
nmAlt = InputBox("?", "Alter Name oder Namensteil")
nmNeu = InputBox("?", "Neuer Name oder Namensteil")
If Len(nmAlt) Len(nmNeu) Then
MsgBox "bubu"
Else
For Each nm In ActiveWorkbook.Names
If Left(nm, Len(nmAlt)) = nmAlt Then
Application.WorksheetFunction.Replace(nmalt, 1, len(nmalt), nmneu)
End If
Next nm
End If
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub