Hi all!
Looking for some help with a macro to replace/populate text that is already in a worksheet with user input without the user having to input the known text, just the replacement text.
I have a worksheet with multiple cells containing strings of static text that I am using as a template.
For instance, one cell may read "APEX "State Abbreviation" "City" Local Team "Team Number"
The words "State Abbreviation", "city", and "team number" appear multiple times throughout the document and I'd like to replace each one with the same input.
I was using the below, but am stuck on how to either hide that first input box or enter the known text string phrases as replacement code.
Any help would be greatly appreciated!!!
Sub rpl()
Sheets("sheet1").Select
What = InputBox("Copy "State Abbreviation" into the box")
repl = InputBox("State Abbreviation")
Cells.Replace What:=What, Replacement:=repl, LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Sub rpl()
Sheets("sheet1").Select
What = InputBox("Copy "City" into the box")
repl = InputBox("City")
Cells.Replace What:=What, Replacement:=repl, LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Sub rpl()
Sheets("sheet1").Select
What = InputBox("Copy "Team Number" into the box")
repl = InputBox("Team Number")
Cells.Replace What:=What, Replacement:=repl, LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End Sub
Bookmarks