We help IT Professionals succeed at work.

How to return the colour of a cell

rltomalin
rltomalin asked
on
190 Views
Last Modified: 2012-05-31
Hello

I have a bit of code that works fine - as follows:

*************************************************
Sheet1.Unprotect
    For Each rngCell In Sheet1.Range("listing")
            If Not rngCell.Locked And Not IsEmpty(rngCell.Value) Then
            rngCell.Locked = True
            rngCell.Interior.Color = RGB(200, 200, 200)
            intN = intN + 1
        End If
    Next rngCell
    Sheet1.Protect
***************************************************

This looks in a range and finds any unlocked cells with content and then locks and colours them.

In another routine, I would like to do a similar thing, but instead of looking for the locked status I would like to look for a specific cell colour (or NOT a specific cell colour).

Is there a statement that would do that please?

Regards

Richard
Comment
Watch Question

Grand Poobah
CERTIFIED EXPERT
Most Valuable Expert 2011
Top Expert 2011
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Thanks rorya

That works fine

Richard
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.