Change Background Color for Entire Sheet
76,049
Solution 1
You can do this quite easy with this code:
Public Sub Demo()
'set color
WorksheetName.Cells.Interior.ColorIndex = 1 'black
'clear color
WorksheetName.Cells.Interior.ColorIndex = xlColorIndexNone
end sub
Or if you don't need VBA, just click at this little icon in the corner:
and select a color, or to use no color - using right click menu or ribbon menu.
Just because of the other answers, I want to remind - it is not necessary to use selections! This is bad macro-recorder style. There are only few occations, where using selections is necessary or a good idea. You can always just use a specific range.
Solution 2
Try this
Sheets("Sheet1").Select
Cells.Select
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Solution 3
Here is how you can change the background color for all cells in the current sheet
Cells.Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark1
.TintAndShade = -0.14996795556505 'grey color
.PatternTintAndShade = 0
End With
Comments
-
Adrian over 4 years
Is there a way to change the Background color into
xlNone
, for example to the entire sheet. I see that you can put a background image... But how can you change the color for all cells in the sheet? -
Adrian over 11 yearsYes, I think your solution is complete and faster!
-
CustomX over 11 yearsYou're setting the background color to a greyish color, not removing it ;)
-
Ahmad over 10 years@t.thielemans, that is what the person who asked the question wants, isn't it?