PDA

View Full Version : How do I check for data



cubbycub
08-16-2007, 02:19 AM
Firstly I'm using excel 2007

I wonder if anyone could help me, i'm having a senior moment and can get round the problem.

Im filtering a partslist, which has headers, to look for data that I then add to another worksheet

WrkShtLastRow = Cells(Rows.Count, "A").End(xlUp).Row
Set rng = Range("A5:G" & WrkShtLastRow)
rng.AutoFilter Field:=4, Criteria1:="<>"
rng.SpecialCells(xlCellTypeVisible).EntireRow.Copy Worksheets("BOList").Range("A" & ManLstLastRow)

what I would like to do is to bypass the copy if there is no data After the filter (there is no specific cell/column that i can say would def. have data in)

Thanks in advance

CUB

Bob Phillips
08-16-2007, 02:33 AM
Untested



WrkShtLastRow = Cells(Rows.Count, "A").End(xlUp).Row
Set rng = Range("A5:G" & WrkShtLastRow)
rng.AutoFilter Field:=4, Criteria1:="<>"
On Error GoTo 0
Set rng = rng.SpecialCells(xlCellTypeVisible)
On Error GoTo 0
If Not rng Is Nothing Then _
rng.EntireRow.Copy Worksheets("BOList").Range("A" & ManLstLastRow)