Jagwarman
asked on
VBA Code that will filter and copy but not if there is no data
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") .AutoFilte r Field:=20, Criteria1:="<>"
If ActiveSheet.Cells(Rows.Cou nt, 1).End(xlUp).Row > 1 Then
Range("A2").Select
Else
End If
Range("A2").Select
Dim LR As Long
LR = Range("A" & Rows.Count).End(xlUp).Row
Range("A2:T" & LR).SpecialCells(xlCellTyp eVisible). Select
Selection.Copy
Sheets("Sheet1").Select
Range("A1").Select
Selection.End(xlDown).Sele ct
ActiveCell.Offset(1, 0).Select
ActiveSheet.Paste
Appreciate some help.
Thank you
I was trying to use the below code but if there is no data it copies the header
ActiveSheet.Range("$A:$T")
If ActiveSheet.Cells(Rows.Cou
Range("A2").Select
Else
End If
Range("A2").Select
Dim LR As Long
LR = Range("A" & Rows.Count).End(xlUp).Row
Range("A2:T" & LR).SpecialCells(xlCellTyp
Selection.Copy
Sheets("Sheet1").Select
Range("A1").Select
Selection.End(xlDown).Sele
ActiveCell.Offset(1, 0).Select
ActiveSheet.Paste
Appreciate some help.
Thank you
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.