Avatar of rltomalin
rltomalin
Flag for United Kingdom of Great Britain and Northern Ireland asked on

How to return the colour of a cell

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
Microsoft Excel

Avatar of undefined
Last Comment
rltomalin

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Rory Archibald

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
rltomalin

ASKER
Thanks rorya

That works fine

Richard
Your help has saved me hundreds of hours of internet surfing.
fblack61