ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Create a Macro to update File and Worksheet References in Formulas (https://www.excelbanter.com/excel-programming/402545-create-macro-update-file-worksheet-references-formulas.html)

Padrager

Create a Macro to update File and Worksheet References in Formulas
 
I need to create a macro that will update the file name and worksheet (tab)
references for all formulas within a range. I already have set up form drop
down boxes for the users to select the file and worksheet reference. I need
the VBA coding that will capture the users inputs and complete a find/replace
on all of the formulas for file name/worksheet. Would anyone provide the code
or point me in the direction of where this has been discussed previously?
Much Thanks!!!!

joel

Create a Macro to update File and Worksheet References in Formulas
 
Sub replaceformula()

OldFile = "OldFile"
NewFile = "NewFile"
OldSheetName = "OldSheet"
NewSheetName = "NewSheet"

Set ReplaceRange = Range("A1:G7")
ReplaceRange.Replace What:=OldFile, _
Replacement:=NewFile, _
SearchOrder:=xlByColumns, _
MatchCase:=True
ReplaceRange.Replace What:=OldSheetName, _
Replacement:=NewSheetName, _
SearchOrder:=xlByColumns, _
MatchCase:=True

End Sub


"Padrager" wrote:

I need to create a macro that will update the file name and worksheet (tab)
references for all formulas within a range. I already have set up form drop
down boxes for the users to select the file and worksheet reference. I need
the VBA coding that will capture the users inputs and complete a find/replace
on all of the formulas for file name/worksheet. Would anyone provide the code
or point me in the direction of where this has been discussed previously?
Much Thanks!!!!



All times are GMT +1. The time now is 02:55 PM.

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