?
Solved

VBA Excel 2000 - Basic colors handling

Posted on 2011-02-15
2
Medium Priority
?
896 Views
Last Modified: 2012-05-11
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
Comment
Question by:csehz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 85

Accepted Solution

by:
Rory Archibald earned 2000 total points
ID: 34895482
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
 
LVL 1

Author Comment

by:csehz
ID: 34895553
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] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question