how to check if background color is yellow?

dee101

Active Member
Joined
Aug 21, 2004
Messages
270
I want to check a range and see if the interior color is yellow, and if so let me know which cell or cells it is, something like this

If range("A4:A8, A12:A16,A20:A24,A28:A32").Interior.coler = 6 then let me know what cells are yellow
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

Ruddles

Well-known Member
Joined
Aug 24, 2010
Messages
5,786
Is the background yellow because someone set it to yellow or is it yellow because of conditional formatting?
 

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Try

Code:
Sub Yeller()
Dim c As Range
Dim msg As String
For Each c In Range("A4:A8,A12:A16,A20:A24,A28:A32")
    If c.Interior.ColorIndex = 6 Then msg = msg & c.Address(False, False) & ", "
Next c
If msg <> "" Then MsgBox Left(msg, Len(msg) - 2), vbInformation, "Yellow cells"
End Sub
 

Forum statistics

Threads
1,141,217
Messages
5,705,071
Members
421,377
Latest member
FerdiFuchs

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
Top