Select All Sheets and clear Interior Cell colours

E

ExcelMonkey

How do you select all sheets in VBA to clear interior
colours. When I record it looks like this. However I
want to avoid using sheet names like this.


Sheets(Array
("Sheet1", "Sheet2", "Sheet3", "Sheet4", "Sheet5","Sheet6"
, "Sheet7", "Sheet8", "Sheet9")). Select
Sheets("Audit Results").Activate
Cells.Select
Selection.Interior.ColorIndex = xlNone
 
B

Bob Phillips

For Each sh In ACtiveworkbook.Worksheets
sh.Cells.Interior.ColorIndex = xlNone
Next sh

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
G

Guest

You can not just select all of the worksheets, but you can traverse through
the collection of worksheets...

dim wks as worksheet

for each wks in worksheets
wks.cells.Interior.ColorIndex = xlNone
next wks

HTH
 
G

Gord Dibben

Sub clear_color()
Application.ScreenUpdating = False
Dim n As Single
For n = 1 To Sheets.Count
Sheets(n).Cells.Interior.ColorIndex = xlNone
Next n
Application.ScreenUpdating = True
End Sub


Gord Dibben Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

first time array help 3
Selecting multiple sheets 3
Array Printing (Selecting) 1
Change Tag Name Automatically 4
Duplicate all Macros? 2
Simple code crashes Excel 1
Why does this not work? 4
PDF export add-in 2

Top