Duplicate procedure in other sheets

  • Thread starter Thread starter Gotroots
  • Start date Start date
G

Gotroots

What is the best way to duplicate a row insertion in other sheets of a
workbook.

Let me explain by example.

There are 5 sheets in the workbook

Sheet1!

a row is added at R12
A12:G12 are copied from the cell range immediately above

Sheet2! - Sheet5!

These sheets will need the same procedure carried out at R12

Hope someone has the answer. Thank you.
 
when you add and copy at the sheet1, select all sheets.
(under selecting Sheet1 condition, Shift + Ctrl + PgDn )

HTH
if i have false conception, pls forgive and forget.
 
See if this does what you want:

Sub insrtRw()
Dim sh As Worksheet
For Each sh In ActiveWorkbook.Sheets
sh.Rows(12).Insert
sh.Range("A11:G11").Copy sh.Range("A12")
Next
End Sub

Open the VBE, Alt + F11, and copy/paste the code into the code window. If
the window is dark, then from the VBE menu bar Insert>Module, then
copy/paste the code. You can run the code from Excel with
Tools>Macro>Macros then select this macro name and click run.
 
Back
Top