i noticed that there are occurrences of more than one highlighted cell in a row, so i am guessing that you want that row copied over only one...give this a try...
sub comparesheets(shtsheet1 as string, shtsheet2 as string, shtsheet3 as string)
dim mycell as range
dim lastline as long, rownum as long
dim nrow as long
nrow = sheets(shtsheet3).cells(rows.count, "a").end(xlup).row + 1
with sheets(shtsheet1)
.activate
for each mycell in .usedrange
if not mycell.value = sheets(shtsheet2) _
.cells(mycell.row, mycell.column).value then
mycell.interior.color = vbyellow
if mycell.row = rownum then goto nxt1:
Rownum = mycell.row
rows(mycell.row).copy sheets(shtsheet3).cells(nrow, 1)
nrow = nrow + 1
end if
nxt1:
Next
end with
with sheets(shtsheet2)
.activate
for each mycell in .usedrange
if not mycell.value = sheets(shtsheet1) _
.cells(mycell.row, mycell.column).value then
mycell.interior.color = vbyellow
if mycell.row = rownum then goto nxt2:
Rownum = mycell.row
rows(mycell.row).copy sheets(shtsheet3).cells(nrow, 1)
nrow = nrow + 1
end if
nxt2:
Next
end with
end sub
Bookmarks