Solved

Excel VBA/VB.net Gather information about cell fill color and font color

Posted on 2014-03-10
2
625 Views
Last Modified: 2014-03-10
Hi

What Excel VBA code would I use to get the cell fill color and font color in an ARGB
color format so that I can use this information to format a text box on a windows form
0
Comment
Question by:murbro
2 Comments
 
LVL 39

Accepted Solution

by:
nutsch earned 500 total points
ID: 39918784
[A1].interior.color
and
[A1].font.color
will return a RGB value.

to get the different components:

Dim lColor As Long
lColor = Selection.Interior.Color

MsgBox "Red: " & lColor Mod 256 & vbCrLf & _
            "Green: " & Int(lColor / 256) Mod 256 & vbCrLf & _
            "Blue:" & Int(lColor / 256 ^ 2) Mod 256

Open in new window

0
 

Author Closing Comment

by:murbro
ID: 39918832
Thanks very much
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.
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…

860 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