View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default run macro in multiple worksheets

There is nothing wrong with the code presented except that you do NOT need
to select to do as desired. Probably something else wrong. Post ALL of your
code for comments

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"SteveDB1" wrote in message
...
Hi all.
Back on April 7, 2006 an individual calling themselves
Yardbird(
http://www.microsoft.com/communities...5-233243fafda4)
posted on their desire to run a macro in a workbook to cover all the
worksheets in a workbook.
Gary Brown, Tom Ogilvy, and Bob Phillips responded with their resolution.
I'm now trying the code they used, and get a 1004 error. I did replace the
workbook.worksheets with activeworkbook.worksheets.

Dim sh as Worksheet
for each sh in ActiveWorkbook.Worksheets
sh.Select
'code for my macro here....
Next Sh

It appears to get hung up on the 'sh.select', stating that "sh is
nothing."

how do I resolve this to get it working?
(my macro code works great without this, and would like to get it to work
for all worksheets in a single stroke. )
Thank you.
Best.