Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
halem2
 
Posts: n/a
Default Running Same macro in 250 Worksheets in Same Workbook


Hi All:

I have an Excel 2000 spk3 workbook which has about 270 identically
formatted worksheets in it. I have a simple macro that clears some
cells and I need to run it from worksheet 11 all the way thru worksheet
270.

I need to automate it so I don't have to go to every worksheet, run the
macro and go to the next and run it and so forth.

Any suggestions would be welcome.


--
halem2
------------------------------------------------------------------------
halem2's Profile: http://www.excelforum.com/member.php...fo&userid=9930
View this thread: http://www.excelforum.com/showthread...hreadid=525787

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ken Wright
 
Posts: n/a
Default Running Same macro in 250 Worksheets in Same Workbook

Sub abc()
For Each sht In ActiveWorkbook.Worksheets
sht.Activate
Range("A1").Value = 999
Next sht
End Sub

Sub cde()
For Each sht In ActiveWorkbook.Worksheets
sht.Range("A1").Value = 999
Next sht
End Sub

First way activates each sheet and second doesn't. Note that the second
explicity references each sheet

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03

------------------------------*------------------------------*----------------
It's easier to beg forgiveness than ask permission :-)
------------------------------*------------------------------*----------------


"halem2" wrote in
message ...

Hi All:

I have an Excel 2000 spk3 workbook which has about 270 identically
formatted worksheets in it. I have a simple macro that clears some
cells and I need to run it from worksheet 11 all the way thru worksheet
270.

I need to automate it so I don't have to go to every worksheet, run the
macro and go to the next and run it and so forth.

Any suggestions would be welcome.


--
halem2
------------------------------------------------------------------------
halem2's Profile:
http://www.excelforum.com/member.php...fo&userid=9930
View this thread: http://www.excelforum.com/showthread...hreadid=525787



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
halem2
 
Posts: n/a
Default Running Same macro in 250 Worksheets in Same Workbook


Thanks Ken. this is how I got it to work.

Sub UpdateAll()
Dim sh As Worksheet
Dim wb As Workbook
Set wb = ActiveWorkbook
'
For Each sh In ActiveWorkbook.Worksheets
sh.Activate
UPDATE
Next
Sheets("710").Select
End Sub


thanks a lot.


--
halem2
------------------------------------------------------------------------
halem2's Profile: http://www.excelforum.com/member.php...fo&userid=9930
View this thread: http://www.excelforum.com/showthread...hreadid=525787

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ken Wright
 
Posts: n/a
Default Running Same macro in 250 Worksheets in Same Workbook

You're welcome :-)

Regards
Ken..............

"halem2" wrote in
message ...

Thanks Ken. this is how I got it to work.

Sub UpdateAll()
Dim sh As Worksheet
Dim wb As Workbook
Set wb = ActiveWorkbook
'
For Each sh In ActiveWorkbook.Worksheets
sh.Activate
UPDATE
Next
Sheets("710").Select
End Sub


thanks a lot.


--
halem2
------------------------------------------------------------------------
halem2's Profile:
http://www.excelforum.com/member.php...fo&userid=9930
View this thread: http://www.excelforum.com/showthread...hreadid=525787



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Protecting all worksheets of a workbook neeraj Excel Discussion (Misc queries) 14 May 30th 06 09:46 PM
Macro pulling data from 2 worksheets billrl34 Excel Discussion (Misc queries) 2 December 12th 05 08:50 PM
checking that cells have a value before the workbook will close kcdonaldson Excel Worksheet Functions 8 December 5th 05 04:57 PM
run macro on workbook close Nigel Excel Discussion (Misc queries) 3 November 29th 05 08:48 PM
Running a macro for all visible worksheets in a workbook Craig_Richards Excel Discussion (Misc queries) 2 August 8th 05 12:24 PM


All times are GMT +1. The time now is 12:11 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"