Breskin
Marine/Ocean
- Oct 2, 2002
- 2
The procedure I need to implement in Excel inserts 3 new rows below two existing rows in a spreadsheet, and then copies data from the row above those new rows into each of the new rows, and then moves down to the next "old row" inserts 3 new rows, and copies the second old row into these rows. For the next thousand (or more) old rows.
Interpolated values in the new rows (based on the values in the old rows above and below them) would be nice, but that is not essential. What is essential is to automate insertion of the rows containing the in-between values without harming the old values.
The purpose is to allow correction of depth recorded by a submerged instrument that creates a record every 15 minutes, using atmospheric pressure from a buoy that creates a record every hour.
In the macro recorder I first insert new rows
Rows("3:5".Select
Selection.Insert Shift:=xlDown
Rows("7:9".Select
Selection.Insert Shift:=xlDown
etc.
and then I copy the existing row into new rows
Rows("2:2".Select
Application.CutCopyMode = False
Selection.Copy
Rows("2:5".Select
ActiveSheet.Paste
Rows("6:6".Select
Application.CutCopyMode = False
Selection.Copy
Rows("6:9".Select
etc.
This works fine for a small worksheet, but is unscalable for a big one. How can I automate this process?
Interpolated values in the new rows (based on the values in the old rows above and below them) would be nice, but that is not essential. What is essential is to automate insertion of the rows containing the in-between values without harming the old values.
The purpose is to allow correction of depth recorded by a submerged instrument that creates a record every 15 minutes, using atmospheric pressure from a buoy that creates a record every hour.
In the macro recorder I first insert new rows
Rows("3:5".Select
Selection.Insert Shift:=xlDown
Rows("7:9".Select
Selection.Insert Shift:=xlDown
etc.
and then I copy the existing row into new rows
Rows("2:2".Select
Application.CutCopyMode = False
Selection.Copy
Rows("2:5".Select
ActiveSheet.Paste
Rows("6:6".Select
Application.CutCopyMode = False
Selection.Copy
Rows("6:9".Select
etc.
This works fine for a small worksheet, but is unscalable for a big one. How can I automate this process?