简体   繁体   English

更改 Excel 中字体颜色的按钮

[英]Button to change the color of font in Excel

I am looking to create a button in Excel which will change the color of the font in a specific field.我希望在 Excel 中创建一个按钮,它将更改特定字段中字体的颜色。 Is this possible?这可能吗? Thank you in advance for the support.预先感谢您的支持。

I have seen posts outlining below - but havent been able to do it so far:我看过下面概述的帖子 - 但到目前为止还没有做到:

Private Sub CommandButton1_Click()
    CommandButton1.Font.Size = 18
End Sub

You have to use the .Font.Color from the .Range function.您必须使用.Font.Color中的.Range Instead of Range("A1") use the cell you want to specify and the RGB() function returns to you the color according to the RGB code of it.代替Range("A1")使用您要指定的单元格,并且RGB() function 根据它的 RGB 代码返回颜色给您。 You can check for the color RGB code in many places like Adobe Color or clicking at More Color Options at Excel Toolbar您可以在 Adobe Color等许多地方检查颜色 RGB 代码,或单击 Excel 工具栏上的更多颜色选项

RGB 和十六进制颜色代码

Private Sub CommandButton1_Click()
 Sheet1.Range("A1").Font.Color = RGB(0,0,0)
End Sub

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM