Make macro run on all worksheets except the first

T

tiger

Hi,

I am trying to write an auto run macro that runs on each worksheet in the
workbook except the first upon opening. I am using

Sub Auto_Open()
'
' Auto_Open Macro
' Macro recorded 29/05/2007 by Kirsty Liddicoat
'

Dim ws As Worksheet
For Each ws In Worksheets(Array(2, 3, 4, 5, 6))
'macro action
Next ws

End Sub

being what I am trying to achieve. This is working but the macro is only
running on the sheet it opens up on not all of the worksheets.

Any suggestions?
 
O

Otto Moehrbach

Tiger
The macro you have, as written, will always work on the active sheet.
Nothing in your macro changes the active sheet. Add the following line
before "'macro action:
ws.select
HTH Otto
 

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