Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 901
  • Last Modified:

VBA Excel 2000 - Basic colors handling

Dear Experts,

Could you propose a reliable way of using VBA commands about font coloring?

I am aware two versions for example to blue
Worksheets("Sheet1").Range("A1").Font.ColorIndex = 6 - this using the place of color from pallet
Worksheets("Sheet1").Range("A1").Font.Color = 16711680 - this would set the blue color, but as I perceive at default color pallet settings, it became yellow :-)

Is there maybe chance to use RGB values in VBA?

thanks,
0
csehz
Asked:
csehz
1 Solution
 
Rory ArchibaldCommented:
If you set the colour of a range using RGB, it will always be mapped to the closest colour in the palette, since you are limited to that many displayed colours. If you really need to ensure that you get a specific RGB value, you will have to alter the palette so that it includes that RGB value.
0
 
csehzAuthor Commented:
Thanks, so I assume to make sure using blue, this should be added always to the workbook

    ActiveWorkbook.ResetColors

and after selecting the blue from the palette, which will be always on the same place in this way

    Selection.Font.ColorIndex = 5

0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now