how to check if background color is yellow?

dee101

Active Member
Joined
Aug 21, 2004
Messages
272
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

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Ruddles

Well-known Member
Joined
Aug 24, 2010
Messages
5,795
Office Version
  1. 365
Platform
  1. Windows
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,175,913
Messages
5,900,256
Members
434,822
Latest member
geedee8185

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