• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Find and Replace Cell colour

nagovind

Member
Dear All,
Kindly advise the code to find the cells that are with the specified colour and then replace the Colour shade of a cell with the selected colour
Example
The Below code does the job of manually selecting the cells. How to automate the same with a code for a sheet without selecting any cells

Code:
Sub C1()

    With Selection.Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .Color = 11433822
        .TintAndShade = 0
        .PatternTintAndShade = 0
    End With

End Sub
Sub C2()
 
    With Selection.Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .Color = 19444052
        .TintAndShade = 0
        .PatternTintAndShade = 0
    End With

End Sub


80567
 

Attachments

  • Colour change.xlsm
    18.4 KB · Views: 4
nagovind
Something like this ... if only usedrange
Code:
Sub Do_It()
    With ActiveSheet
        For Each c In .UsedRange
            If c.Interior.Color = 11433822 Then c.Interior.Color = 19444052
        Next
    End With
End Sub
 
Back
Top