VBA Code that will filter and copy but not if there is no data
Posted on 2014-09-09
I need to filer Row 1 Column 'T' to find items that are 'New' When filtered I need to copy the items [but not the header] and paste these onto a new sheet, but if wheh I filter there is no data I do not want to copy anything.
I was trying to use the below code but if there is no data it copies the header
ActiveSheet.Range("$A:$T").AutoFilter Field:=20, Criteria1:="<>"
If ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row > 1 Then
Dim LR As Long
LR = Range("A" & Rows.Count).End(xlUp).Row
Range("A2:T" & LR).SpecialCells(xlCellTypeVisible).Select
Appreciate some help.