Adding a Row to Multiple Worksheets at Once

J

Jamie

I’m working in Excel 2003. I’m working on a project that will track
employee’s errors (dollar, procedure, or no errors). I have 13 worksheets.
The first one is titled Summary and is followed by worksheets titled January
through December. The Summary worksheet functions as the control. The user
enters each employee’s name on the Summary worksheet into cell A7. The
employee’s name is automatically entered into cell A7 in the January through
December worksheets using =Summary!A7.

The table it self consists of 3 rows and begins on Row 6. Column titles
include (employee’s name, etc.). The user types employee information into
Row 7. Row 8 is a Total row.

What I would like to be able to do is, have a button on the Summary
worksheet that triggers a macro which will add a row below row A7 (new row is
A8) in all 13 worksheets.
 
V

Vasant Nanavati

Use the following macro:

Sub AddRow8()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
Rows(8).Insert
Next
End Sub

______________________________________________________________________
 
M

Mike H

Try this:-

Sub atomic()
Dim WS As Worksheet
For Each WS In Worksheets
WS.Select
Range("A8").Select
Selection.EntireRow.Insert
Next WS
End Sub
 
V

Vasant Nanavati

No need to select anything; but my earlier solution had a flaw (that's what
I get for not testing). It should be:

Sub AddRow8()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Rows(8).Insert
Next
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