Kartik0698
New Member
- Joined
- May 20, 2019
- Messages
- 2
Hi there,
This is the macro code that I am using to apply conditional formatting:
Basically what I am trying to achieve is that if values in column J equals values in column F, then formatting changes in column H. But it is not working as expected(i.e. it also changes the formatting of cells for which the formula returns false. Image for reference:
https://ibb.co/0sKX2LG
This is the macro code that I am using to apply conditional formatting:
Code:
Sub Iden_Match()
'
' Iden_Match Macro
' Identify matching cells
'
' Keyboard Shortcut: Ctrl+Shift+K
'
Range("H3").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlUp)).Select
Application.CutCopyMode = False
Application.CutCopyMode = False
Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=J3=F3"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Font
.Bold = True
.Italic = False
.TintAndShade = 0
End With
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 5296274
.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False
End Sub
https://ibb.co/0sKX2LG