I think the code below will deliver the results you are looking for...
Option Explicit
Sub With_AutoFilter_Maybe()
Dim wsData As Worksheet
Dim wsComment As Worksheet
Dim lr As Long
'For some reason I could not get the ListObject to work with the object wsData...it would only work with the ActiveSheet object
If ActiveSheet.Name = "Data" Then
Set wsComment = ThisWorkbook.Worksheets("Comments Me & You")
Application.ScreenUpdating = False
With ActiveSheet
.ListObjects("Table_List63680").Range.AutoFilter Field:=21, Criteria1:="yes" 'change "Table1" to whatever the name of your table is
lr = .Cells(Rows.Count, 21).End(xlUp).Row
If lr > 1 Then
.Range(.Cells(2, 3), .Cells(lr, 3)).SpecialCells(12).Copy Destination:=wsComment.Range("B4")
.Range(.Cells(2, 16), .Cells(lr, 16)).SpecialCells(12).Copy Destination:=wsComment.Range("D4")
.Range(.Cells(2, 2), .Cells(lr, 2)).SpecialCells(12).Copy Destination:=wsComment.Range("F4")
.Range(.Cells(2, 17), .Cells(lr, 17)).SpecialCells(12).Copy Destination:=wsComment.Range("H4")
.Range(.Cells(2, 7), .Cells(lr, 7)).SpecialCells(12).Copy Destination:=wsComment.Range("J4")
.Range(.Cells(2, 4), .Cells(lr, 4)).SpecialCells(12).Copy Destination:=wsComment.Range("L4")
.Range(.Cells(2, 10), .Cells(lr, 10)).SpecialCells(12).Copy Destination:=wsComment.Range("N4")
End If
.ListObjects("Table_List63680").Range.AutoFilter
End With
Application.ScreenUpdating = True
Else
MsgBox "The 'Data' Sheet must be active to run this code!", vbCritical
End If
End Sub
Bookmarks