Excel macro insert 10 blank rows at top of every tab in a workbook

dwilson38550m

Board Regular
Joined
Nov 21, 2005
Messages
89
Hi, is it possible to use a macro to insert 10 empty rows in row 1 of a workbook and do this for every tab in the workbook? Then I would like to copy a table and I insert this into the 10 blank rows created? I have 100 tabs on the workbook so want to avoid doing things manually.

Thanks.
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Inserting the rows is easy using Vba.
But you did not give us the Name of the Table and did not say where to paste it.

Do you want to paste it starting in Range("A1") of every sheet?
And on what sheet is the Table now?
We need specific details.
 
Upvote 0
Hi, I would like to insert blank rows (rows 1 to 10) on all tabs of the workbook other than the tab called "Table" . Then I'd like to copy the table on cells A1 to P10 from the "Table" tab and paste onto very tab on the w/book (cell A1 to P10) other than the Table tab.

Thanks
 
Upvote 0
Try this

Code:
Sub insert_blank_rows()
  Dim sh As Worksheet
  For Each sh In Sheets
    If LCase(sh.Name) <> LCase("Table") Then
      sh.Rows("1:10").Insert
      sh.Range("A1:P10").Value = Sheets("Table").Range("A1:P10").Value
    End If
  Next
End Sub
 
Upvote 0
Thanks, will this enter the Table in all the sheets in the workbook (apart from the Table tab itself)? Thanks I'll give it a go.
 
Upvote 0
In all tables except the "Table" sheet. Try and tell me.
 
Upvote 0
Perhaps we could do all the tabs at once? (Assuming no formulas of formatting required from the copied table, only values)

Rich (BB code):
Sub InsertAndCopy()
  Sheets.Select
  Rows("1:10").Select
  Selection.Insert
  Range("A1:P10").Select
  Selection.Value = Sheets("Table").Range("A11:P20").Value
  Sheets("Table").Rows("1:10").Delete
  ActiveSheet.Select
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,216,384
Messages
6,130,309
Members
449,571
Latest member
Jay Zyller

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top