Hi Everyone,
Kindly need some solution regarding my project here.
Here is my VBA code, what I want to do is :
1. If the cells in column A have duplicate values, then I will change the font color from black to red for the duplicate values starting from the second occurance (DONE for the code)
2. For rows which have red font color in column A, I want column E until H in that row to be blank (NEED HELP)
3. Then I will delete the conditional formatting so that all cells in column A will have black font color again (DONE for the code)
I've attached the excel display as well here.
Thanks a lot for your help.
Kindly need some solution regarding my project here.
Here is my VBA code, what I want to do is :
1. If the cells in column A have duplicate values, then I will change the font color from black to red for the duplicate values starting from the second occurance (DONE for the code)
2. For rows which have red font color in column A, I want column E until H in that row to be blank (NEED HELP)
3. Then I will delete the conditional formatting so that all cells in column A will have black font color again (DONE for the code)
VBA Code:
Sub SecondOcurrenceFont()
'Give red color to Second Ocurrence
Sheet3.Activate
Columns("A:A").FormatConditions.Add Type:=xlExpression, Formula1:= _
"=COUNTIF($A$1:A1,A1)>1"
With Columns("A:A").FormatConditions(1).Font
.Color = -16776961
End With
'For red color in A give blank to E until H
[B][COLOR=rgb(184, 49, 47)]If Columns("A:A").Font.Color = -16776961 Then[/COLOR][/B]
[COLOR=rgb(184, 49, 47)][B]
Else
[/B][/COLOR]
[B][COLOR=rgb(184, 49, 47)] End If[/COLOR][/B]
'Delete Condition
Columns("A:A").FormatConditions.Delete
End Sub
Thanks a lot for your help.