Hi,
Far from a short title, but very concisive.
I want to format every cell in Col "C" using IconSets under the condition that the corresponding Cell value in Col "A" is larger/similar/lower.
There is a code-snipped that I used so far, and most surprisingly it works only sometimes
* Reason why i run this cell by cell is that i don't see another possibility of setting the values dynamically. If there is a way so I can just define this over the entire column please tell - I'd love to!Function ConditFormat(cpTarget As Range, cpSource As Range) Dim rows As Long Dim sCell As Range Dim tCell As Range 'Range.FormatConditions.Ic With cpTarget .FormatConditions.Delete .FormatConditions.AddIconSetCondition .FormatConditions(cpTarget.FormatConditions.Count).SetFirstPriority ' Global settings for the icon set End With With cpTarget.FormatConditions(1) .ReverseOrder = True .ShowIconOnly = False .IconSet = ActiveWorkbook.IconSets(xl3TrafficLights1) End With For Each tCell In cpTarget With tCell.FormatConditions(1).IconCriteria(2) .Type = xlConditionValueNumber '.Value = Cells(tCell.row, cpSource.Column) .Value = "=" & Cells(tCell.Row, cpSource.Column) .Operator = 7 End With With tCell.FormatConditions(1).IconCriteria(3) .Type = xlConditionValueNumber .Value = "=" & Cells(tCell.Row, cpSource.Column) .Operator = 5 End With Next End Function
If i only run this through a short range, say 3-4 cells, it seems to work. If i run this over an entire column.... it doesnt and everything gets flagged red.
How can I fix this?
Best regards,
Andreas
Bookmarks