Hi folks,
This issue has me nearly tearing my hair out. Can't see what I'm doing wrong. Not really experienced enough in Excel VBA i guess. Anyway here is my code:
With ActiveCell
Dim rng As Range
Dim O As String
Dim P As String
Dim Q As String
Range(Cells(.Row, "R"), Cells(.Row, "FQ")).Select
Set rng = Range(Cells(.Row, "R"), Cells(.Row, "FQ"))
O = Chr(34) & "=$O&" & ActiveCell.Row & Chr(34)
P = Chr(34) & "=$P&" & ActiveCell.Row & Chr(34)
Q = Chr(34) & "=$Q&" & ActiveCell.Row & Chr(34)
rng.FormatConditions.Delete
With rng.FormatConditions.Add(Type:=xlCellValue, Operator:=xlEqual, Formula1:=O)
.Interior.Color = rgbBlue
End With
With rng.FormatConditions.Add(Type:=xlCellValue, Operator:=xlEqual, Formula1:=P)
.Interior.Color = rgbGreen
End With
With rng.FormatConditions.Add(Type:=xlCellValue, Operator:=xlEqual, Formula1:=Q)
.Interior.Color = rgbPurple
End With
End With
It should be applying conditional formatting to the range but when i run the code and check the Conditional formatting window afterwards, all I get is this:
Cell value = "="
Cell value = "="
Cell value = "="
Why is this happening?
Any help much appreciated!
Bookmarks