Duplicate procedure in other sheets

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.
 
M

MRT

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.
 
J

JLGWhiz

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top