By using vba.booksticle.com you agree to our cookie policy, We and our partners operate globally and use cookies, for multiple purposes

948 Steps to 6 Figures by Learning Excel-VBA and Other Skills



Step 788 - Highlight_PrevCurDiffs - udf


This code is passed two cells and will highlight the cells in orange if they're different.

To call

dim c1 as Range, c2 as Range
set c1 = range("A1")
set c2 = range("B1")
Hilight_PrevCurDiffs c1, c2

Sub Hilight_PrevCurDiffs(c1 as range, c2 as range)

if c1.value <> c2.value then
    Range(c1.address & "," & c2.address).select
    With Selection.Interior
      .Color = 49407 ' orange
    end with
End If

End Sub


   Table of Contents | Send us your feedback | © 2025 All Rights Reserved | Edit