ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Can i change a fill color in vba? (https://www.excelbanter.com/excel-programming/358869-can-i-change-fill-color-vba.html)

Jon[_21_]

Can i change a fill color in vba?
 
I am trying to color a selection i have made in vba, is there a command
to do this? Also, I would like to change the font color.


Edwin Tam[_7_]

Can i change a fill color in vba?
 
For example, to fill a cell with yellow:
Selection.Interior.ColorIndex = 6 'yellow

To assign a red font color:
Selection.Font.ColorIndex = 46 'red

Also, why not play with the "record macro" function? From the tools menu,
choose macro, then record macro. Set the color manually and let Excel produce
the macro for you. Then, you can easily find out the correct colorindex for
the color you need!

Regards,
Edwin Tam

http://www.vonixx.com



"Jon" wrote:

I am trying to color a selection i have made in vba, is there a command
to do this? Also, I would like to change the font color.



Jon[_21_]

Can i change a fill color in vba?
 
yer right, im an idiot. thanks



All times are GMT +1. The time now is 08:41 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com