I've been comparing 2 sheets and then highlight differences, what I want to do is, how do I copy the entire row that there is a highlighted cell to another sheet?
Can you help me work this out?
Thank you![]()
Here's my code on comparing
![]()
Sub compareSheets(shtSheet1 As String, shtSheet2 As String) Dim mycell As Range 'For each cell in sheet2 that is not the same in Sheet1, color it yellow For Each mycell In ActiveWorkbook.Worksheets(shtSheet2).UsedRange If Not mycell.Value = ActiveWorkbook.Worksheets(shtSheet1).Cells(mycell.row, mycell.Column).Value Then mycell.Interior.Color = vbYellow End If Next 'For each cell in sheet2 that is not the same in Sheet1, color it yellow For Each mycell In ActiveWorkbook.Worksheets(shtSheet1).UsedRange If Not mycell.Value = ActiveWorkbook.Worksheets(shtSheet2).Cells(mycell.row, mycell.Column).Value Then mycell.Interior.Color = vbYellow End If Next ActiveWorkbook.Sheets(shtSheet2).Select End Sub
Bookmarks