Afro_Cookie
Board Regular
- Joined
- Mar 17, 2020
- Messages
- 103
- Office Version
- 365
- Platform
- Windows
I have some code that helps me highlight unique cells as yellow using VBA. I did this to eliminate my conditional formatting duplicating itself and causing issues in my worksheets. The issue is I want to use RGB colours instead of Themeaccentcolours
Can some of you more experienced people please help me modify that specific part of my code so I can use RGB(0,255,0) in place of xlThemeColorAccent2
Can some of you more experienced people please help me modify that specific part of my code so I can use RGB(0,255,0) in place of xlThemeColorAccent2
VBA Code:
Option Explicit
Public Sub markunique()
Dim iColour As Integer
Dim rng As Range
Dim rngCell As Variant
Dim LR As Long
Dim vVal
LR = Cells(Rows.Count, "B").End(xlUp).Row
Set rng = Range("B6:B" & LR)
iColour = xlThemeColorAccent2
rng.FormatConditions.Delete
For Each rngCell In rng.Cells
vVal = rngCell.Text
If (WorksheetFunction.CountIf(Range("B6:B" & rngCell.Row), vVal) = 1) Then
rngCell.Interior.ColorIndex = iColour
Else
rngCell.Interior.Pattern = xlNone
End If
Next
End Sub