Try this code
Option Explicit
Sub highlight_dups()
Dim j As Long, i As Long
Application.ScreenUpdating = False
With Worksheets("Sheet1")
For j = 2 To 5
For i = 5 To 30
If .Cells(i, j).Value = .Cells(i + 1, j).Value And .Cells(i - 1, j).Value <> .Cells(i, j).Value Then
.Cells(i, j).Font.Color = RGB(255, 0, 0)
.Cells(i + 1, j).Font.Bold = True
ElseIf .Cells(i, j).Value = .Cells(i + 1, j).Value And .Cells(i - 1, j).Value = .Cells(i, j).Value Then
.Cells(i + 1, j).Font.Bold = True
End If
Next i
Next j
End With
MsgBox "Done"
Application.ScreenUpdating = True
End Sub
Bookmarks