更改整个工作表的背景颜色 [英] Change Background Color for Entire Sheet
问题描述
是否可以将背景颜色更改为xlNone
,
例如整个工作表.我发现您可以放置背景图片...
但是如何更改工作表中所有单元格的颜色?
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?
推荐答案
您可以使用以下代码轻松完成此操作:
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
或者,如果您不需要VBA,只需单击角落的这个小图标即可:
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.
这篇关于更改整个工作表的背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!