I have 2 books. Source book and assignment workbook. They are completely identical, with the exception of one sheet that has the same name in both but different data (both contain about 30 sheets). What I wanted to do was copy the remaining identical worksheets from the source workbook to the destination workbook, leaving 1 sheet in it that stores the data.
In principle, identical worksheets present in the assignment workbook should be replaced by those specified in the source workbook. Worksheets contain formulas and named ranges. I was successfully able to write VBA code to copy worksheets. But since the named ranges have the volume of a workbook. The named ranges still refer to source book locations. So I get 2 named ranges with the same name. Sort of:
'The one already present in the destination workbook (from the worksheet which was replaced) Name=VaccStart , Refers To =Sheet2!$A$2 'The one due to the copied worksheet. Name=VaccStart , Refers To =[C:\Users\.....\Source.xls]Sheet2!$A$2
I want named ranges to refer to the target book, not the source book when I copy them. Since all the sheets in both books are the same, and I just replace them.
source share