ich bräuchte Hilfe für ein Macro, eine Formel funktioniert für meine Zwecke nicht.
Wenn z. B. in Spalte B die Nr. 123 in beliebiger Zeile steht, müsste in Spalte B eine 1 den dort vorhandenen Wert ersetzen.
Für Eure Hilfe jetzt schon vielen Dank.
Sub replace123()
Range("B:B").Replace What:="123", Replacement:="1", LookAt:=xlWhole
End Sub
' **********************************************************************
' Modul: Modul1 Typ: Allgemeines Modul
' **********************************************************************
Option Explicit
Sub replace123()
Dim objFind As Object, objReplace As Object, strFirst As String
With Range("B:B")
Set objFind = .Find(What:="123", LookIn:=xlValues, LookAt:=xlWhole, SearchFormat:=False)
If Not objFind Is Nothing Then
strFirst = objFind.Address
Do
If objReplace Is Nothing Then
Set objReplace = objFind.Offset(0, -1)
Else
Set objReplace = Union(objReplace, objFind.Offset(0, -1))
End If
Set objFind = .FindNext(objFind)
Loop While Not objFind Is Nothing And strFirst <> objFind.Address
End If
End With
If Not objReplace Is Nothing Then objReplace = 1
Set objReplace = Nothing
Set objFind = Nothing
End Sub