Many a times you will need to show colors at run time for your cool Excel application. A good mix of Colors can make a application more attractive and make users happy.
To fill a cell using VBA following code can be used
and to change font color using VBA following code can be used
Where 'yoursheet' is the sheet you are dealing with in your VBA code and 'color_num' is the value of color you wish to use. Following is the Color Palette for your reference
To fill a cell using VBA following code can be used
yoursheet.Cells(i + 2, 1).Interior.ColorIndex = color_num
and to change font color using VBA following code can be used
yoursheet.Cells(i + 2, 2).Font.ColorIndex = color_num
Where 'yoursheet' is the sheet you are dealing with in your VBA code and 'color_num' is the value of color you wish to use. Following is the Color Palette for your reference
To view the full Palette please follow the below link.
0 comments:
Post a Comment