Hi I need/want a VBA for conditional formatting that triggers every time the Sheet is Selected
column F has Serial Number running from “F5:F30000”, I need if possible, to have.
I have added as normal conditional formatting but as the data is copied and pasted into the list the formatting is wiped, I have also tried Recording as a macro but it fails run. I can get it to work for 1 or the other using the code below.
column F has Serial Number running from “F5:F30000”, I need if possible, to have.
- Blank cells to stay White
- If the same ser no is entered in to F5:F2000 the cell to go red,
- If a Ser no is entered between F5:F30000 the cell goes amber.
I have added as normal conditional formatting but as the data is copied and pasted into the list the formatting is wiped, I have also tried Recording as a macro but it fails run. I can get it to work for 1 or the other using the code below.
VBA Code:
Sub FormatDuplicate()
Range("F5:F2000").Select
With Selection
.FormatConditions.AddUniqueValues
.FormatConditions(1).DupeUnique = xlDuplicate
.FormatConditions(1).Interior.Color = RGB(255, 0, 0)
End With
End Sub