I am having problems with my code snippet below. I am almost certain that the error lies in Formula1:=CStr(ucl.Address).
I can get the code to work by changing it to ucl.Value, but I need the formatting to be linked to the ucl CELL, not it's value, so that it will update when the value in ucl changes...
I feel like i've tried most of the things I can think of, but no luck.
How do I get this to work the way I described above?
Help, please
I can get the code to work by changing it to ucl.Value, but I need the formatting to be linked to the ucl CELL, not it's value, so that it will update when the value in ucl changes...
I feel like i've tried most of the things I can think of, but no luck.
How do I get this to work the way I described above?
Help, please
Code:
Sub AddConditionalFormats(FormatArea As Range)
Dim col As Range
Dim ucl As Range
Dim lcl As Range
FormatArea.FormatConditions.Delete
For Each col In FormatArea.Columns
Set ucl = Cells(4, col.Column)
Set lcl = Cells(2, col.Column)
col.Select
'GREATER THAN UCL
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, Formula1:=CStr(ucl.Address)
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
...
...