xander1981
01-31-2014, 08:20 PM
Hello, I am having trouble when the cell in column G is blank after filtering three columns to three different criteria. If the first active row is blank after filter I need a message box. I am getting the error, no cells were found. Any help would be very appreciated.
'Filter to Line Rate, copy and paste
With ActiveWorkbook.Worksheets("Rates Matrix").Select
Sheets("Rates Matrix").Range("$A$1:$F$5000").AutoFilter Field:=1, Criteria1:=Destination
Sheets("Rates Matrix").Range("$A$1:$F$5000").AutoFilter Field:=3, Criteria1:=Carrier
Sheets("Rates Matrix").Range("$A$1:$F$5000").AutoFilter Field:=4, Criteria1:=Size
Range("G2:G1000").Select
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Offset(0, 0).Select
Selection.Copy
ActiveSheet.Range("A2").Select
End With
Sheets("Rates").Select
CarrierResult.Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveSheet.Range("G7").Select
'Filter to Line Rate, copy and paste
With ActiveWorkbook.Worksheets("Rates Matrix").Select
Sheets("Rates Matrix").Range("$A$1:$F$5000").AutoFilter Field:=1, Criteria1:=Destination
Sheets("Rates Matrix").Range("$A$1:$F$5000").AutoFilter Field:=3, Criteria1:=Carrier
Sheets("Rates Matrix").Range("$A$1:$F$5000").AutoFilter Field:=4, Criteria1:=Size
Range("G2:G1000").Select
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Offset(0, 0).Select
Selection.Copy
ActiveSheet.Range("A2").Select
End With
Sheets("Rates").Select
CarrierResult.Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveSheet.Range("G7").Select