Solved

VBA Excel 2000 - Basic colors handling

Posted on 2011-02-15
2
888 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
2 Comments
 
LVL 85

Accepted Solution

by:
Rory Archibald earned 500 total points
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Dealing with unintended Excel Active-X resizing quirks (VBA code simulates "self correction") David Miller (dlmille) Intro Not everyone is a fan of Active-X controls in spreadsheets (as opposed to the UserForm approach, the older Form controls …
Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now