troubleshooting Question

How to return the colour of a cell

Avatar of rltomalin
rltomalinFlag for United Kingdom of Great Britain and Northern Ireland asked on
Microsoft Excel
2 Comments1 Solution193 ViewsLast Modified:

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

    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

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?


Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros