View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Clear all including objects without deleting sheets

Try code like the following:

Sub AAA()
Dim WS As Worksheet
Dim OleObj As OLEObject
Dim SH As Shape

Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each WS In ThisWorkbook.Worksheets
If WS.Tab.ColorIndex 0 Then
For Each OleObj In WS.OLEObjects
OleObj.Delete
Next OleObj
For Each SH In WS.Shapes
SH.Delete
Next SH
End If
Next WS
End Sub


Cordially,
Chip Pearson
Microsoft Most Valuable Professional,
Excel, 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com



On Thu, 15 Apr 2010 10:29:02 -0700, Curt
wrote:

I would like a macro that uses the "EDIT" - "CLEAR ALL" command for all
sheets that do not have colored tabs. I would also like it to remove all
charts, objects, images, etc. for all sheets that do not have colored tabs.

Currently, I can only remove all objects by manually deleting each object
one at a time. Deleting the sheets is not an option because that results in
cell refrences for me as I refrence cells in the sheets that I am trying to
clear.

Any help is greatly appreciated!

Curt J