Changing colour in various cells via Macro

ghrek

Active Member
Joined
Jul 29, 2005
Messages
426
Hi

I have a workbook that has various cells in green and others in red with the word NO and also some cells that are just blank.

What im trying to do is have something that looks in the range F4 -AM82 and if the cell colour is red with the word NO I need it changed back to a blank green cell.

Can this be done?
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Always try macros on a sample data first
VBA Code:
Sub Coloer()
        Dim rng As Range
       
        For Each rng In Range("F4:AM82")
            If rng.Interior.Color = vbRed And UCase(rng.Value) = "NO" Then
                    rng.Interior.Color = vbGreen
                    rng.value = ""
            End If
        Next rng

End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,215,016
Messages
6,122,700
Members
449,092
Latest member
snoom82

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top