Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

Can I copy my multi-tab template down each worksheet and retain relative references?

0

I have a bidding template I use as cost buildup to price the ships that work for my company.

There are 8 tabs with data and formulas that are interlinked, though not all tabs link to each other, some do.  A summary tab however is linked to all of the other 7 tabs.

Each tab has from ~70 to ~200 rows of data with ~10 to ~20 columns, some of the tabs are formatted similarly but not identical.

This is a template for one ship, I would like to copy it down each tab and retain the relative references so it reads and writes to the new pasted copy of it below and I can edit it - for another ship and another down each tab.

I have done this but none of the relative references work, even if copying all from cell A1 in row 1 to cell A400 in row 400 accross all of the tabs, it does not retain the correct relative cell referencing. 

In the attached file, I manually fixed the 2nd entire copy starting at line 101, which is 4 lines below the header and data is then aligned - in the Summary tab, and then tried to copy that down to line 400.  There must be a way to keep from having to manually fix all of the relative references again?  I'm not concerned with the few fixed references, I can quickly change those and have not decided if they should apply to the entire tab in any case. 

I may want to add another 5 to 10 data sets as such and manual editing seems the wrong way to do this. 

Answer
Discuss

Answers

0
Selected Answer

Hi and welcome to the Forum

It sounds like your sheets are complicated but adding "another 5 to 10 data sets" it a one-off task so I'll suggest a non VBA method...

If you copy several tabs, Excel will keep the relationships so please:

  1. click the first sheet (Summary), shift + left click the last sheet (Demob TP) to select all sheets.
  2. Right click/ choose "Move or Copy"
  3. In the requestor, click "Create a copy" then under "Before Sheet:" scroll down to select "(move to end)" then click OK

You'll get a bunch of new tabs, named like Summary(2) whose formulae relate to the new tabs. E.g. cell E4 in Summary(2) will read 

='DayRate K Equip (2)'!O31

If you select that sub-tab and rename it to DayRate K Equip (Vessel 2) say, go back to E4 and you'll see the formula has changed to match, so:

='DayRate K Equip (Vessel 2)'!O31

i.e. Excel has catered for the change of the sheet name.

Personally, I would stop there (after repeating a number of times), with a group of tabs, each particular (and named) to a single vessel. You could set the tab colour for a given group to differentiate it from others- shift click to select the group (as above) then right-click and pick "Tab Color>" to choose the colour. (Note you'll need to select another tab to deselect them and see the colours.) You could even drag all the re-named Summary sheets to the left for convenience (and optionally Hide all the sub-tabs)..

If you really want all like data on a single set of tabs (as your question suggests), you could Cut rows 1 to 167 of DayRate K Equip (Vessel 2) say and Paste them in A171 (and down) of DayRate K Equip and you'll then see that the formula in E4 in Summary(2) will read:

='DayRate K Equip'!O201

i.e. Excel has again altered things to suit. You can then do similar for other tabs, including Summary(2) , then delete the empty tabs.

Hope this helps.

Discuss

Discussion

Did you try that? 
John_Ru (rep: 6152) Feb 3, '22 at 2:56 am
Thanks for selecting my Answer.
John_Ru (rep: 6152) Feb 6, '22 at 8:22 am
It worked well. Thanks!
jmccarty (rep: 2) Feb 25, '22 at 1:42 am
Great! 
John_Ru (rep: 6152) Feb 25, '22 at 1:48 am
It took me some time to go over it again, much appreciated!
jmccarty (rep: 2) Feb 25, '22 at 2:06 am
Add to Discussion


Answer the Question

You must create an account to use the forum. Create an Account or Login