Conditional Format Result - Get Fill Colour

mikeymay

Well-known Member
Joined
Jan 17, 2006
Messages
1,645
Office Version
  1. 365
Platform
  1. Windows
Is there a way of establishing the colour of a cell after conditional formatting has been applied?

The following returns the default or non CF set fill color
VBA Code:
cell.Interior.Color

The cells have no fill but the CF applied will return Red, Amber or Green but I can't find the correct way to establish this.


Thanks
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Maybe:
VBA Code:
cell.DisplayFormat.Interior.Color
 
Upvote 0
What is the rest of your code?
 
Upvote 0
What is the rest of your code?
VBA Code:
Function RAGCheck(cell As Range)

RAGCheck = ???
    
End Function

The cell contains the following formula
Excel Formula:
=RAGCheck(B6)
 
Upvote 0
The below line does not seem to be supported inside a function:
VBA Code:
cell.DisplayFormat.Interior.Color

A possible workaround could be to have a variable set outside of the function to then call back:
VBA Code:
Dim rCol As Long
Function RAGCheck(cell As Range)
    rCol = cell.Interior.Color
    RAGCheck = rCol
End Function
 
Upvote 0
You cannot use DisplayFormat in a UDF called from a cell.
 
Upvote 0
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
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