View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default run macro in multiple worksheets

Do you have a hidden worksheet in your workbook ?


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"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.