I need to include code to handle errors that may occur, but I have been unsuccessful.
At two points, there could be no data in the list.
I need to stop and display an error msg box rather than having the user stop the code.
The first point in the code is when the data is pasted from Data sheet to Filtered_data sheet.
'create criteria range
Set rng = Sheets("Data").Range("a1").End(xlToRight).Offset(0, 2)
rng.Value = frmData.lblRatedWeight.Caption
rng.Offset(1, 0).Formula = "="">=""&" & "Details!A3"
Sheets("Data").Range("A1").CurrentRegion.AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Sheets("Data").Range(rng, rng.Offset(1)), CopyToRange:=Range("Filtered_Data!A1"), Unique:=False
Sheets("Data").Range(rng, rng.Offset(1)).Value = vbNullString
If there is no data for Filtered_Data sheet, I need a msg "There are no shipments meeting the min package weight"
The second point in the code is the Filter () when there is nothing on the Report tab after -
rngData.AutoFilter Field:=i, Criteria1:="<" & Sheets("Details").Range("B3").Value
Range(Range("A2"), Range("A" & Rows.Count).End(xlUp)).SpecialCells(xlCellTypeVisible).EntireRow.Delete
If ActiveSheet.AutoFilterMode = True Then ActiveSheet.AutoFilterMode = False
I need a msg box to say "There are no shipments meeting the min shipment weight."