Insert rows in grouped sheets

H

halibut

I'm trying insert rows in grouped sheets. I am using the following
code:

Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Select
Rows(9).Resize(3, 1).EntireRow.Insert Shift:=xlDown

The sheets are grouped, however the additional rows are only inserted
in sheet1. How do I get the additional rows inserted in the all the
sheets in the array?


Thanks

Paul
 
J

Jim Rech

The grouped sheet behavior you're trying to use only works from the
keyboard. You can try to simulate that with SendKeys:

Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Select
Rows(9).Resize(3, 1).EntireRow.Select
SendKeys "^{+}"
 
D

Don Guillett Excel MVP

I'm trying insert rows in grouped sheets. I am using the following
code:

Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Select
Rows(9).Resize(3, 1).EntireRow.Insert Shift:=xlDown

The sheets are grouped, however the additional rows are only inserted
in sheet1. How do I get the additional rows inserted in the all the
sheets in the array?

Thanks

Paul

Sub insertrows()
For Each ws In Array("Sheet1", "Sheet2", "Sheet3")
Sheets(ws).Rows(9).Resize(3).Insert
Next ws
End Sub
 

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