#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Tom Ogilvy

Hi Tom:

a few pages back you helped me with this macro to clean several sheet
by calling a macro called ClearSheet.

Sub CleanAllSheets()
For Each sh In ActiveWorkbook.Worksheets
sh.Activate
ClearSheet
Next
End Sub

I have a sheet in the workbook that is protected and the macro fail
when it gets to it. How can I run it on all sheets except on a shee
called FORM?

thanks a million..

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default Tom Ogilvy

Try this...

Sub CleanAllSheets()
For Each sh In ActiveWorkbook.Worksheets
if sh.name < "FORM" then
sh.Activate
ClearSheet
End if
Next
End Sub


"halem2 " wrote:

Hi Tom:

a few pages back you helped me with this macro to clean several sheets
by calling a macro called ClearSheet.

Sub CleanAllSheets()
For Each sh In ActiveWorkbook.Worksheets
sh.Activate
ClearSheet
Next
End Sub

I have a sheet in the workbook that is protected and the macro fails
when it gets to it. How can I run it on all sheets except on a sheet
called FORM?

thanks a million...


---
Message posted from http://www.ExcelForum.com/


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Tom Ogilvy

I would suggest a slight revision to make it case insensitive

Sub CleanAllSheets()
Dim sh as Worksheet
For Each sh In ActiveWorkbook.Worksheets
if Ucase(sh.name) < "FORM" then
sh.Activate
ClearSheet
End if
Next
End Sub

--
Regards,
Tom Ogilvy


"Jim Thomlinson" wrote in message
...
Try this...

Sub CleanAllSheets()
For Each sh In ActiveWorkbook.Worksheets
if sh.name < "FORM" then
sh.Activate
ClearSheet
End if
Next
End Sub


"halem2 " wrote:

Hi Tom:

a few pages back you helped me with this macro to clean several sheets
by calling a macro called ClearSheet.

Sub CleanAllSheets()
For Each sh In ActiveWorkbook.Worksheets
sh.Activate
ClearSheet
Next
End Sub

I have a sheet in the workbook that is protected and the macro fails
when it gets to it. How can I run it on all sheets except on a sheet
called FORM?

thanks a million...


---
Message posted from http://www.ExcelForum.com/




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Tom Ogilvy

thank you both. Thanks you Tom for all the help

--
Message posted from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Tom Ogilvy

thank you both. Thanks you Tom for all the help

--
Message posted from http://www.ExcelForum.com



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
Thank You Tom Ogilvy Brian Excel Worksheet Functions 0 December 16th 04 02:47 AM
Tom Ogilvy David Joseph Excel Programming 0 April 21st 04 02:57 PM
Tom Ogilvy David Joseph Excel Programming 0 April 21st 04 02:37 PM
Tom Ogilvy David Joseph Excel Programming 1 April 21st 04 12:38 AM
Help Tom Ogilvy [email protected] Excel Programming 9 January 18th 04 11:18 PM


All times are GMT +1. The time now is 06:05 PM.

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"