PDA

View Full Version : [SOLVED:] Conditional Formating Issue



nikki333
07-28-2018, 02:53 PM
Hi folks

I'm trying to set a conditional formating rule via VBA. The macro recorder doesn't seem to pick up anything (useful) in my case.

Basically, it's about checking whether the cell value in column B match one out of three criteria, and then to format the frame and interior color of the whole row in question.

So far I've benn trying like so:



With rngKriterien
.FormatConditions.Add Type:=xlExpression, Formula1:="=$B4=ODER(""Rüster-unabhängig""; ""Rüster-abhängig""; ""Allergenmonitoring"")"
.FormatConditions(rngKriterien.FormatConditions.Count).SetFirstPriority
With .FormatConditions(1)
With .Borders(xlInsideHorizontal): .Color = strColor1: End With
With .Borders(xlInsideVertical): .Color = strColor1: End With
End With
End With


This works to set a rule with the formula and doesn't give any error message, however, it seems to ignore the .borders alltogether.

Any ideas?

Cherrio

Fluff
07-29-2018, 08:58 AM
You cannot create inside borders using CF

nikki333
07-30-2018, 01:05 PM
Thanks fluff, I'm just wondering if there's a plausible reason behind this, or just lack of functionality

I've now understood that setting horizontal inside borders on a single row doesn't make sense, but at least for the vertical ones that should work

Fluff
07-30-2018, 01:21 PM
I've no idea what the reason is behind it I'm afraid.
Although it may have something to do with the fact that the CF could simply be changing one cell & therefore you could not have internal borders.