T
Tripla
I have 3 worksheets in my Workbook. Each sheet is from 3 separate
years AA05,AA06,AA07 and named accordingly. I have this code to check
each Column B of all the worksheets for matches and I was hoping to
return the results of the unmatched to a new Output sheet. Can anyone
help?
Ex:
Worksheet AA05
A B
1 Banks, Tom
2 Hanks,John
3 Johnson, Rob
Worksheet AA06
A B
1 Banks, Tom
2 Hawton,John
3 Johnthorp, Rob
WorksheetAA07
A B
1 Banks, Tom
2 Hawton,John
3 Johnson, Rob
Sub ()
Dim sht As Worksheet
Dim lrow As Long
Dim dest_lrow As Long
For Each sht In ActiveWorkbook.Worksheets
If sht.Name <> "Output" Then
sht.Activate
lrow = sht.Range("B" & Rows.Count).End(xlUp).Row
dest_lrow = Worksheets("Output ").Range("B" &
Rows.Count).End(xlUp).Row
Range("B1").AutoFilter Field:=1, Criteria1:="<>"
Range("A1:d" & lrow).SpecialCells(xlCellTypeVisible).Copy
Worksheets("Output ").Range ("A" & dest_lrow + 1)
Selection.AutoFilter
End If
Next sht
Worksheets("Output ").Select
End Sub
years AA05,AA06,AA07 and named accordingly. I have this code to check
each Column B of all the worksheets for matches and I was hoping to
return the results of the unmatched to a new Output sheet. Can anyone
help?
Ex:
Worksheet AA05
A B
1 Banks, Tom
2 Hanks,John
3 Johnson, Rob
Worksheet AA06
A B
1 Banks, Tom
2 Hawton,John
3 Johnthorp, Rob
WorksheetAA07
A B
1 Banks, Tom
2 Hawton,John
3 Johnson, Rob
Sub ()
Dim sht As Worksheet
Dim lrow As Long
Dim dest_lrow As Long
For Each sht In ActiveWorkbook.Worksheets
If sht.Name <> "Output" Then
sht.Activate
lrow = sht.Range("B" & Rows.Count).End(xlUp).Row
dest_lrow = Worksheets("Output ").Range("B" &
Rows.Count).End(xlUp).Row
Range("B1").AutoFilter Field:=1, Criteria1:="<>"
Range("A1:d" & lrow).SpecialCells(xlCellTypeVisible).Copy
Worksheets("Output ").Range ("A" & dest_lrow + 1)
Selection.AutoFilter
End If
Next sht
Worksheets("Output ").Select
End Sub