Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set all sheets' fill color to "No Fill" using VBA in excel

How can I Set all sheets fill color to No fill using VBA in excel (all cells). Same as select all sheets, Select all cells (Control+A) and change fill color to No fill.

like image 429
Eghbal Avatar asked Dec 05 '16 11:12

Eghbal


People also ask

What color Index is no fill in VBA?

The following line of VBA code will allow you to determine if a spreadsheet cell has a fill color. If the ColorIndex property of a given cell is equal to xlNone (-4142) then it can be determined that there is no fill color in that particular cell.

What is the color code for no fill?

Default/no fill colour is grey.


1 Answers

Untested but should do the job:

Sub No_Fill_Wb()

Dim ws as worksheet

For each ws in Thisworkbook.Worksheets
    ws.Cells.Interior.ColorIndex = 0
Next ws

End Sub
like image 171
Jordan Avatar answered Sep 20 '22 05:09

Jordan