Reputation: 691
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?
Upvotes: 7
Views: 79865
Reputation: 4682
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.
Upvotes: 18
Reputation: 12707
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
Upvotes: 2
Reputation: 10113
Try this
Sheets("Sheet1").Select
Cells.Select
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Upvotes: 2