Is it possible to insert/delete rows in a file and make other files automatically update their rows accordingly?

Ian Y

New Member
Joined
Nov 18, 2023
Messages
37
Office Version
  1. 2019
Platform
  1. Windows
Below are two worksheets. The one named Template.xlsx is used as a template for staves to clone, and it only has four columns. The one named Staff-Tom.xlsx is one of the staff worksheets that was originally cloned using Template.xlsx. Other staves, say Michael, may clone Template.xlsx as well and rename the file as Staff-Michael.xlsx, and start writing content starting from column E.

Column A to column D need to be the same in all worksheets. Regarding column C (Line Count), I mean its formulas need to be the same in all worksheets; the displaying numbers in that column would be conceivably different in all staff worksheets.

My question is that, is it possible to insert or delete rows in Template.xlsx and make all staff worksheets automatically update their rows accordingly? For example, after I delete row 6 (whose ID is g5ofMqYRaI) in Template.xlsx, row 6 in all staff worksheets are automatically deleted, regardless whether staves have written lines in that row; and after I insert a new row at any position in Template.xlsx, all staff worksheets automatically gain that new row at the same position?

Template.xlsx
ABCD
1IDCategoryLine CountTag
2jEgzB7egxfcat60tag2
3EiLx7pFANhcat10tag8
4SnTVQD4gwQcat90tag1
5g7GHnd0jQ4cat60tag7
6g5ofMqYRaIcat30tag10
7wpDX0biIMRcat100tag5
8LJ2YAvty8vcat20tag8
9R6pS1llU1Vcat70tag3
10oX1yY6mf5Kcat50tag1
11tjZfGS16hqcat100tag6
Sheet1
Cell Formulas
RangeFormula
C2:C11C2=SUM(LEN(E2:Z2)-LEN(SUBSTITUTE(E2:Z2,CHAR(10),""))+(E2:Z2<>""))
Press CTRL+SHIFT+ENTER to enter array formulas.

Staff-Tom.xlsx
ABCDEF
1IDCategoryLine CountTag7-Jan8-Jan
2jEgzB7egxfcat63tag2This is a line. This is another line. Yet another line.
3EiLx7pFANhcat13tag8This is the only line.This is a line. This is a wonderful line.
4SnTVQD4gwQcat93tag1A line here. How are you? Another line here. Hey! The last line here. See you.
5g7GHnd0jQ4cat63tag7This is a line. Hello. This is a line, too.I'm the only line here.
6g5ofMqYRaIcat32tag10How are you today? I'm fine. Thank you.
7wpDX0biIMRcat104tag5This is the first line. This is the second line. This is the third line. This is the last line.
8LJ2YAvty8vcat23tag8Only one line in this cell.Hey. What's up? Let's write another line here.
9R6pS1llU1Vcat72tag3This cell has lines. Any other cell can be empty.
10oX1yY6mf5Kcat50tag1
11tjZfGS16hqcat103tag6This is a whaterever line. A cell can have many lines. A cell can also have only one line.
Sheet1
Cell Formulas
RangeFormula
C2:C11C2=SUM(LEN(E2:Z2)-LEN(SUBSTITUTE(E2:Z2,CHAR(10),""))+(E2:Z2<>""))
Press CTRL+SHIFT+ENTER to enter array formulas.

The two worksheets above are streamlined versions for demonstrative purposes. The actual worksheets can contain as many rows as possible. And staff worksheets can contain as many staff-written columns, starting from column E, as possible.
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
In VBA anything is possible, but if you are not 100% sure where the copies are stored you are out of luck trying to remove those rows from all copies.
And depending on the number of copies, this may end up being frightfully slow.
 
Upvote 0
In VBA anything is possible, but if you are not 100% sure where the copies are stored you are out of luck trying to remove those rows from all copies.
And depending on the number of copies, this may end up being frightfully slow.
All the files, including Template.xlsx, will be stored in the same directory.

I think the number of staff worksheets won't be more than 20. A staff worksheet only needs to update when it is opened. It's not necessary that all staff worksheets are updated at the same time when Template.xlsx is updated.
 
Upvote 0
If you want this controlled when one of the copies is opened, you have two choices:
  1. Create an add-in which every user (!) must have installed, which monitors opening of files, detects if it is one of those copies, opens the template, compares both and aligns the rows
  2. Change the template and all copies of it to xlsm files and add code to them that runs on file open to align the rows
Consider the maintenance of these xlsm files; you might need to update the VBA code one day, in umpteen files...

If these files are in a Sharepoint or OneDrive location, I would try to use Power Automate which would take these steps:
  1. Read template, get all identifyers (plus any additional information needed for new rows)
  2. Run through all files in the folder, then trigger an Office script which checks their identifyer column and deletes any rows which aren't in the template or adds rows wich aren't in the copy.
I'd decide on how often that script needs to run, like once a day.
 
Upvote 0

Forum statistics

Threads
1,223,234
Messages
6,170,891
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top