Solved

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

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
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 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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

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

13 Experts available now in Live!

Get 1:1 Help Now