Change background color for whole sheet

Is there a way to change the background color to xlNone , for example, to the whole sheet. I see that you can put a background image ... But how can you change the color for all cells on a sheet?

+4
source share
3 answers

You can do this quite easily 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 do not need VBA, just click on this little icon in the corner:

enter image description here

and select a color or do not use color - using the right-click menu or the ribbon menu.

Just because of the other answers, I want to remind you - there is no need to use a choice! This is a bad style macro recorder. There are only a few cases where the use of elections is necessary or a good idea. You can always use a specific range.

+14
source

try it

 Sheets("Sheet1").Select Cells.Select With Selection.Interior .Pattern = xlNone .TintAndShade = 0 .PatternTintAndShade = 0 End With 
+2
source

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 
+2
source

Source: https://habr.com/ru/post/1441249/


All Articles