Solved

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

Posted on 2014-03-10
2
619 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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 …
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

932 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

11 Experts available now in Live!

Get 1:1 Help Now