Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- https://excel-egy.com/forum/t4172
- ---------------------------------
- Sub Highlight_Rows_Do_Not_Exist_In_Another_Sheet()
- Dim ws As Worksheet, sh As Worksheet, rng As Range, c As Range, m As Long, n As Long, i As Long
- Application.ScreenUpdating = False
- Set ws = ThisWorkbook.Worksheets(1)
- Set sh = ThisWorkbook.Worksheets(2)
- m = ws.Cells(Rows.Count, 1).End(xlUp).Row
- n = sh.Cells(Rows.Count, 1).End(xlUp).Row
- For Each c In ws.Range("A2:D" & m).Rows
- c.Offset(, c.Columns.Count + 2).Cells(1).Value = Application.Trim(Join(Application.Index(c.Value, 1, 0)))
- Next c
- For Each c In sh.Range("A2:D" & n).Rows
- c.Offset(, c.Columns.Count + 2).Cells(1).Value = Application.Trim(Join(Application.Index(c.Value, 1, 0)))
- Next c
- For i = 1 To n
- Set rng = ws.Range("G:G").Find(sh.Cells(i, 7))
- If rng Is Nothing Then sh.Cells(i, 1).Resize(1, 4).Interior.Color = vbRed
- Next i
- ws.Columns(7).Clear: sh.Columns(7).Clear
- Application.ScreenUpdating = True
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement