Conditional Formatting Multiple Values

indi visual

Junior Member
Oct 15, 2010
6
0
0
Quite simply, I would like to sort and filter names and dates (in specified colors given the specified dates).

What has taken me four days to figure out will likely take someone in this forum seconds.
I am very new to all of this, and I come modestly, respectfully, and appreciative for any help.
I have a few questions, but they are all connected, and with a few short answers I can have my entire sheet functioning beautifully.

Conditional formatting is the most simple way to do this. However, I have a =ColorFunction sub that conditional formatting would interfere with (because it is my understanding the “=ColorFunction” does not recognize colors highlighted conditionally (or with private subs either). For this reason, I have thrown together an alternative sub macro that creates the same result that my colorfunction formula could recognize.

Code:
Sub Highlight_Date_Today_Red()
'searches finds and highlights today date in range in a specified color without the use of standard conditional formatting
' Highlight_Date_Today_Red Macro

Range("E4:E1000").Select
    Application.FindFormat.Clear
     'On Error Resume Next
Cells.Find(What:=DateValue(Today), After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False).Activate

        With Selection.Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .Color = 255
        .TintAndShade = 0
        .PatternTintAndShade = 0
    End With
End Sub

It worked but it only highlighted one cell. Sad for me, and yes it is okay to laugh at my code (but at least give me credit for attempting this Frankenstein monstrosity) Lol

Here are my four questions:

How do I get it to search and highlight the current date today throughout the entire column accordingly?

As for multiple values, how would I get it to highlight yesterday’s date in another the color the same way accordingly?

Next, how would I write this same code with something along the lines of:

Code:
If Range(“H4”) contains “/”, then highlight cell (“E4”) in this color?

Finally,

Code:
If Range(“H4”) contains no fill color, then highlight cell (“E4”) in this color?


Any help on this would be super extremely appreciated you have no idea. I tried so many variations from so many forums for so long that it’s time I sought help from someone. Anyone who can help me this will have a speedy response from me guaranteed. I will be monitoring any responses round the clock. Thanks in advance.

Quick note: I did make sure the dates I attempted to find and highlight were formatted as “date cells” and not “text cells”.
 
Last edited:

Emulex

Diamond Member
Jan 28, 2001
9,759
1
71
why wouldn't you just enumerate the color to a cell and hide it? then reference that cell? same with background.

seems easier to me. i like to store stuff in tables (sql) so colors and highlights would have to be stored as a varchar or int depending on your style.


but that's just another way of looking at it - i am not attempting to solve your problem
 

indi visual

Junior Member
Oct 15, 2010
6
0
0
I would like to count column E4:E1000.

I would like to count the number of "today's date" in that column.

I have a cell in J1 with the following formula
Code:
=ColorFunction($J$1,$E$4:$E$1000, FALSE)

Whatever color J1 is (which is red in this case),
it counts the number of cells in E4:E1000 that are just like it.

However, if those red dates are conditionally formatted in red, the J1 formula will read that there are '0' red current date highlight cells in the E Column even though there might be some (because it cannot read conditionally formatted red).

I've tried to conditionally format J1, so that all conditionally formatted red cells in the E column would match. But for one reason or another the only way this =ColorFunction formula works is if it's a regular fill of red (and not a CF of red).

Hence, why I am trying to frankenstein a way to change the interior color of all my dates today in the E column Without the use of conditional formatting.