G
Guest
I have a macro that finds and replaces (I found it here, thanks!) I need to
adapt it from looping through all worksheets to just cells I select. Can
someone help?
TIA
Todd
Sub FindReplace()
Dim wks As Worksheet
Dim WhatToReplace As String
Dim WithWhat As String
WhatToReplace = InputBox(Prompt:="What this time?")
If WhatToReplace = "" Then
Exit Sub
End If
WithWhat = InputBox(Prompt:="what should: " & Chr(34) & _
WhatToReplace & Chr(34) & " be replaced with?")
If WithWhat = "" Then
Exit Sub
End If
For Each wks In ActiveWorkbook.Worksheets
wks.Cells.Replace what:=WhatToReplace, _
Replacement:=WithWhat, lookat:=xlPart, _
MatchCase:=False
Next wks
End Sub
adapt it from looping through all worksheets to just cells I select. Can
someone help?
TIA
Todd
Sub FindReplace()
Dim wks As Worksheet
Dim WhatToReplace As String
Dim WithWhat As String
WhatToReplace = InputBox(Prompt:="What this time?")
If WhatToReplace = "" Then
Exit Sub
End If
WithWhat = InputBox(Prompt:="what should: " & Chr(34) & _
WhatToReplace & Chr(34) & " be replaced with?")
If WithWhat = "" Then
Exit Sub
End If
For Each wks In ActiveWorkbook.Worksheets
wks.Cells.Replace what:=WhatToReplace, _
Replacement:=WithWhat, lookat:=xlPart, _
MatchCase:=False
Next wks
End Sub