VBA Code to find Interior Color set by Conditional Formatting

Mister H

Well-known Member
Joined
Mar 6, 2002
Messages
1,507
Hi All:

I have a spreadsheet where I have set up Conditional Formatting in some cells. IF certain criteria are not met then the cell turns red
.ColorIndex = 3

Is there any VBA Code that can detect interior color that was set up by Conditional Formatting. I have been seraching the internet for quite a while and found the code below which I modified slightly. It works if I set the interior color to RED via formatting but it ddoes not seem to recognize the RED interior when it is set up through COnditional Formatting. Can this code be modified to work for me? Is ther another code I could use? I would appreciate even if someone can tell me "Not Possible". THANKS.

Code:
Sub FindRedInterior()
Dim FoundCell As Range
 
'just in case there's other stuff that's been specified
Application.FindFormat.Clear
Application.FindFormat.Interior.ColorIndex = 3
 
With ActiveSheet
Set FoundCell = .Range("Revenue_Distribution").Find(What:="", _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=True)
If FoundCell Is Nothing Then
Exit Sub
 
Else

Application.Goto FoundCell, Scroll:=True
MsgBox prompt:="Please fill in any cells highlighted in RED " _
& "and then click on the Email Button again" _
& vbNewLine & "Start with: " _
& FoundCell.Address(0, 0), _
Title:="Jrnl 1 Corrections"
 
End If
End With
End Sub

ANY Suggestions :confused:

THANKS for looking,
Take Care,
Mark :)
 
Using the .DisplayFormat property in a UDF will cause it to return #VALUE when used in a worksheet formula, even though the UDF will work fine when called by VB. (Similarly the .Find and .SpecialCells properties and others).

Testing the conditions that tigger the CF would we the way to go.
 
Upvote 0

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

Forum statistics

Threads
1,224,825
Messages
6,181,189
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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