Mithunrnair
New Member
- Joined
- Nov 18, 2019
- Messages
- 5
Need a help to highlight the respective cells, if a user (name) in rage A have an SIA and WU value in rage B.
The code I have, dosent work completely but some what give an idea where I am now.
Any help really appreciated.... Thanks in advance
The code I have, dosent work completely but some what give an idea where I am now.
VBA Code:
Sub HighlightCell ()
Dim cell As Range, rg As Range, rng As Range, cond1 As FormatCondition, cond2 As FormatCondition, cond3 As FormatCondition
Range("A1", Range("A2").End(xlDown)).Select
Selection.Copy
Range("F1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveSheet.Range("F2").End(xlDown)).RemoveDuplicates Columns:=1, Header:=xlYes
Set rg = Range("B2", Range("B2").End(xlDown))
Set rng = Range("F2", Range("F2").End(xlDown))
For Each cell In rng
rg.FormatConditions.Delete
Set cond1 = rg.FormatConditions.Add(xlCellValue, xlEqual, "SIA")
Set cond2 = rg.FormatConditions.Add(xlCellValue, xlEqual, "WU")
'define the format applied for each conditional format
With cond1
.Interior.Color = vbGreen
.Font.Color = vbWhite
End With
With cond2
.Interior.Color = vbGreen
.Font.Color = vbWhite
End With
Next cell
End Sub
Any help really appreciated.... Thanks in advance