rfletcher35
Active Member
- Joined
- Jul 20, 2011
- Messages
- 300
- Office Version
-
- 365
- Platform
-
- Windows
I have the following code
Sheets("MPR Data").Select
ActiveSheet.Range("$T$4:$AD$4000").AutoFilter Field:=9, Criteria1:="x"
ActiveSheet.Range("$T$4:$AD$4000").AutoFilter Field:=1, Criteria1:="365"
If Range("T5:AB4000").SpecialCells(xlCellTypeVisible).Value > "" Then
Range("T5:AB4000").SpecialCells(xlCellTypeVisible).Select
Selection.Copy
Sheets("Results Sheet").Select
Range("P5").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Else
End If
My code is failing at the line If Range("T5:AB4000").SpecialCells(xlCellTypeVisible).Value > "" Then
I have the above filters in place and sometimes the filters return nothing and when it does it fails as it tries to copy nothing. I'm trying to put a step in to avoid that, so if filters produce nothing it goes on to the next part of my coding.
Can anyone assist with this please?
Thanks
Fletch
Sheets("MPR Data").Select
ActiveSheet.Range("$T$4:$AD$4000").AutoFilter Field:=9, Criteria1:="x"
ActiveSheet.Range("$T$4:$AD$4000").AutoFilter Field:=1, Criteria1:="365"
If Range("T5:AB4000").SpecialCells(xlCellTypeVisible).Value > "" Then
Range("T5:AB4000").SpecialCells(xlCellTypeVisible).Select
Selection.Copy
Sheets("Results Sheet").Select
Range("P5").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Else
End If
My code is failing at the line If Range("T5:AB4000").SpecialCells(xlCellTypeVisible).Value > "" Then
I have the above filters in place and sometimes the filters return nothing and when it does it fails as it tries to copy nothing. I'm trying to put a step in to avoid that, so if filters produce nothing it goes on to the next part of my coding.
Can anyone assist with this please?
Thanks
Fletch