Hi,
How do i check whether filtering have result or not.
Would like to do multiple looping and check whether there are filtering being done. If filter shows result then run code if no result then go to next filtering.
Continued from this thread
http://www.ozgrid.com/forum/showthre…&goto=newpost**
This code is working, but would like the filtering to be outside.
Code
Sub Test()
Dim rng As Range, lRows As Long
With ActiveSheet
' Find the number of rows containing data
lRows = .Cells(.Rows.Count, 1).End(xlUp).Row
' Filter the sheet. Use only the range that contains data.
.Range(.Cells(4, 3)).AutoFilter Field:=3, _
Criteria1:=Array(Split(Worksheets("FILTERING CRITERIA").Range("A2").Value, ",")), Operator:=xlFilterValues
' Test whether data has been returned
' Error trap needed as assigning a range variable to no visible rows will error
Set rng = Nothing
On Error Resume Next
' Assign the range to the row below the header cells, down to the end of the data
Set rng = .Range(.Cells(5, 3), .Cells(lRows, 3)).SpecialCells(xlCellTypeVisible)
On Error GoTo 0
' If there is no data displayed, 'rng' will be equal to Nothing
' Test, and action accordingly
If Not rng Is Nothing Then
' Do stuff with the visible data returned
Call MAP_MOLD_PACKAGES
End If
End With
End Sub
Display More