Sub HighlightDuplicates() Dim lastRow As Long Dim lastCol As Long Dim rng As Range Dim cell As Range Dim dict As Object ' Find the last row with data in column A lastRow = Cells(Rows.Count, "A").End(xlUp).Row ' Find the last column with data in the range lastCol = Cells(1, Columns.Count).End(xlToLeft).Column ' Define the range of data Set rng = Range("A2").Resize(lastRow - 1, lastCol) ' Assuming data is in columns A to lastCol ' Create a dictionary object to store unique values Set dict = CreateObject("Scripting.Dictionary") ' Loop through each cell in the range For Each cell In rng.Columns(1).Cells ' Only consider the first column (Number column) If dict.exists(cell.Value) Then ' Highlight the cells until the last column if the value is a duplicate For Each c In Range(cell, Cells(cell.Row, lastCol)) If c.Value <> "" Then ' Check if cell contains data c.Interior.Color = RGB(255, 0, 0) ' Red color End If Next c Else ' Add the value to the dictionary if it's not a duplicate dict(cell.Value) = 1 End If Next cell End Sub