简体   繁体   中英

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. 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. 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. You can check for the color RGB code in many places like Adobe Color or clicking at More Color Options at Excel Toolbar

RGB 和十六进制颜色代码

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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