Solved

VBA Excel 2000 - Basic colors handling

Posted on 2011-02-15
2
892 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 500 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

730 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