![]() |
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 |
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/ |
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/ |
Tom Ogilvy
|
Tom Ogilvy
|
All times are GMT +1. The time now is 11:36 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com