ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Inserting multiple rows in multiple worksheets (https://www.excelbanter.com/excel-programming/439233-inserting-multiple-rows-multiple-worksheets.html)

Andrew

Inserting multiple rows in multiple worksheets
 
I am trying to develop a worksheet where a number of worksheets are linked to
a master worksheet. The sheets that are linked to the master have similar
formatting ie; alternate rows are shaded & there are formulas, eg; sheet 1 is
master, sheet 2 has blue rows, sheet 3 has green rows, sheet 4 has yellow
rows, etc.
My dilemma is this: The master sheet is protected & not meant for editing,
only calclating & displaying totals. So what i would like to do is if i add a
row (with formatting) in sheet 2 it will automatically add to the master
sheet, if i add row(s) to sheet 3, it will automatically update in the master
sheet and so on. The real problem lies in that fact that i might insert a row
above row #25 on sheet 2 but the corresponding row on the master sheet may be
row # 175, & Sheet 3 row #85 = Master sheet row #250
I currenlty have it set up so that data is entered on sheet 2(or whichever
sheet) & it is automatically updated to the master sheet (simple equal
cells).

I dont know if this is possible or probable but any help appreciated.
I might also add that i've only started exploring vba concepts so may not be
familar with lingo.

Thanks in advance for any help.

Paul

Inserting multiple rows in multiple worksheets
 
You could name a range on each sheet being the first row of the standard
structure, then calculate where to insert the rows based on the offset from
that range :

nOffset = selection.row - Range("Sheet1_Top_Row").Row
' This gives you the offset to use when inserting on each of the other sheets

' On the next sheet
nNewRow = Range("Sheet2_Top_Row").Row + nOffset - 1
cells(nNewRow,1).entirerow.insert shift:=xldown


--
If the post is helpful, please consider donating something to an animal
charity on my behalf.


"Andrew" wrote:

I am trying to develop a worksheet where a number of worksheets are linked to
a master worksheet. The sheets that are linked to the master have similar
formatting ie; alternate rows are shaded & there are formulas, eg; sheet 1 is
master, sheet 2 has blue rows, sheet 3 has green rows, sheet 4 has yellow
rows, etc.
My dilemma is this: The master sheet is protected & not meant for editing,
only calclating & displaying totals. So what i would like to do is if i add a
row (with formatting) in sheet 2 it will automatically add to the master
sheet, if i add row(s) to sheet 3, it will automatically update in the master
sheet and so on. The real problem lies in that fact that i might insert a row
above row #25 on sheet 2 but the corresponding row on the master sheet may be
row # 175, & Sheet 3 row #85 = Master sheet row #250
I currenlty have it set up so that data is entered on sheet 2(or whichever
sheet) & it is automatically updated to the master sheet (simple equal
cells).

I dont know if this is possible or probable but any help appreciated.
I might also add that i've only started exploring vba concepts so may not be
familar with lingo.

Thanks in advance for any help.



All times are GMT +1. The time now is 03:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com