T
thadpole
I have Workbook-A with worksheets 'Sheet1' and 'Sheet2'. I also have
Workbook-B with 'Sheet1' and 'Sheet2'.
I want to replace Workbook-B's Sheet2 with Workbook-A's Sheet2.
Workbook-B's Sheet2 must retain the same worksheet name because there are
formulas on other sheets which refer to 'Sheet2'.
I've tried copying, deleting, and renaming like this...
Dim WBA As Workbook
Dim WBB As Workbook
Set WBA = Workbooks("Workbook-A.xls")
Set WBB = Workbooks("Workbook-B.xls")
WBA.Worksheets("Sheet2").Copy after:=WBB.Worksheets("Sheet2")
'creates a worksheet called "Sheet2 (2)" on WBB since the name already exists.
WBB.Worksheets("Sheet2").Delete
WBB.Worksheets("Sheet2 (2)").name = "Sheet2"
All the formulas which referred to Sheet2 now lose their references and they
don't restore their reference when 'Sheet2 (2)' is renamed to 'Sheet2'.
Thank you for your help!
Workbook-B with 'Sheet1' and 'Sheet2'.
I want to replace Workbook-B's Sheet2 with Workbook-A's Sheet2.
Workbook-B's Sheet2 must retain the same worksheet name because there are
formulas on other sheets which refer to 'Sheet2'.
I've tried copying, deleting, and renaming like this...
Dim WBA As Workbook
Dim WBB As Workbook
Set WBA = Workbooks("Workbook-A.xls")
Set WBB = Workbooks("Workbook-B.xls")
WBA.Worksheets("Sheet2").Copy after:=WBB.Worksheets("Sheet2")
'creates a worksheet called "Sheet2 (2)" on WBB since the name already exists.
WBB.Worksheets("Sheet2").Delete
WBB.Worksheets("Sheet2 (2)").name = "Sheet2"
All the formulas which referred to Sheet2 now lose their references and they
don't restore their reference when 'Sheet2 (2)' is renamed to 'Sheet2'.
Thank you for your help!