Sub test() Dim col1 As Integer, col2 As Integer, col As Integer, rrow As Integer Dim lastrow As Integer col1 = Range("J1").Column col2 = Range("Y1").Column lastrow = Worksheets("sheet1").Range("J2").End(xlDown).Row 'MsgBox lastrow Worksheets("sheet1").Cells.Interior.ColorIndex = xlNone For col = col1 To col2 Step 3 For rrow = 2 To lastrow 'MsgBox Cells(1, col).Address 'MsgBox rrow If Worksheets("sheet1").Cells(rrow, col) - Worksheets("sheet2").Cells(rrow, col) > 20 Or _ Worksheets("sheet2").Cells(rrow, col) - Worksheets("sheet2").Cells(rrow, col) < 20 Then Worksheets("sheet1").Cells(rrow, col).Interior.ColorIndex = 3 End If Next Next End Sub
Sub undo() Worksheets("sheet1").Cells.Interior.ColorIndex = xlNone End Sub
DON'T MISS