I have VBA code that opens a file, deletes a sheet called "Parameters" and then does this:
The problem is that when I am in the first workbook the named ranges are now referenced as [Projects.xlsm]Parameters!$b$38, etc. Previously they were just Parameters!$B$38, etc. Any suggestions on how to get them to "copy over" successfully. Note: the scope on them is needed to always be Workbook because these parameters are used in many places throughout each workbook they appear in.
Code:
Sheets("Parameters").Select
ActiveWindow.SelectedSheets.Delete
'Now delete all the named ranges because they will reference errors
ActiveWorkbook.Names("Fee").Delete
ActiveWorkbook.Names("BillingEmail").Delete
ActiveWorkbook.Names("BillingEmail2").Delete
ActiveWorkbook.Names("BillingPhone").Delete
ActiveWorkbook.Names("BillingPhone2").Delete
'Then it goes to the "master" file and gets the new paramters sheet and
'moves it to the open file (above) that had the parameters sheet removed
Windows("Projects.xlsm").Activate
Sheets("Parameters").Select
Sheets("Parameters").Copy Before:=Workbooks(ThisBook).Sheets(1)
'ThisBook is the variable for the first file above.
The problem is that when I am in the first workbook the named ranges are now referenced as [Projects.xlsm]Parameters!$b$38, etc. Previously they were just Parameters!$B$38, etc. Any suggestions on how to get them to "copy over" successfully. Note: the scope on them is needed to always be Workbook because these parameters are used in many places throughout each workbook they appear in.