使用VBA更改Excel中标签的颜色? [英] Changing color of tabs in Excel using VBA?
本文介绍了使用VBA更改Excel中标签的颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用wbBK2.Sheets(wsWS1).Tab
.Color = 255
结束
现在上面的代码适用于各个选项卡,但我想知道有没有办法更改所有四个选项卡同时使用Excel VBA?
谢谢。
解决方案
像这样:
Dim Sht As Worksheet
对于每个Sht在Application.Worksheets
与Sht.Tab
.Color = 255
结束
下一个Sht
注意:
我认为您可以将 Application.Worksheets
更改为 wbBK2.Worksheets
,但是我运行的咖啡因太低,以记住或时间来测试。
I have script I created that creates a new sheet, and a new tab in said sheet, before changing the names of said tabs, I want to make it so Sheet1 through Sheet4 all are red.
With wbBK2.Sheets(wsWS1).Tab
.Color = 255
End With
Now the code above works for individual tabs, but I am wondering is there a way to change all four tabs at the same time using Excel VBA?
Thanks.
解决方案
Try something like this:
Dim Sht As Worksheet
For Each Sht In Application.Worksheets
With Sht.Tab
.Color = 255
End With
Next Sht
Note:
I think you may be able to change Application.Worksheets
to wbBK2.Worksheets
, but I'm running too low on caffeine to remember, or time to test it.
这篇关于使用VBA更改Excel中标签的颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文