Link to home
Start Free TrialLog in
Avatar of rltomalin
rltomalinFlag 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
ASKER CERTIFIED SOLUTION
Avatar of Rory Archibald
Rory Archibald
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rltomalin

ASKER

Thanks rorya

That works fine

Richard