ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Seach & Replace Macro (https://www.excelbanter.com/excel-programming/363566-seach-replace-macro.html)

NQ Muzza

Seach & Replace Macro
 
I am preparing a template spreadsheet for a number of business units and
want to have a macro that will take a text label from a cell and run a macro
to replace a placeholder "BRANCHNAME" with the actual branch's name
throughout a multi-sheet document. i.e. Sometimes the "branchname" is only a
part of the text in the cell.

Help would be appreciated.
Thanks,
Murray



Tom Ogilvy

Seach & Replace Macro
 
s= Worksheets("Sheet1").Range("A1").Value
Cells.Replace What:="Branchname", _
Replacement:=s, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
MatchCase:=False

--
Regards,
Tom Ogilvy

"NQ Muzza" wrote:

I am preparing a template spreadsheet for a number of business units and
want to have a macro that will take a text label from a cell and run a macro
to replace a placeholder "BRANCHNAME" with the actual branch's name
throughout a multi-sheet document. i.e. Sometimes the "branchname" is only a
part of the text in the cell.

Help would be appreciated.
Thanks,
Murray





All times are GMT +1. The time now is 04:01 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com