Notifications
Clear all
Always try to avoid Loops. I hadn't noticed that my code didn't count Rows from the SpecialCells
Option Explicit
'' —————————————————————————————
'' Procedure: TestFiltered
'' DateTime : 10/10/2005 18:50
'' Amende: 02/07/2016
'' Author: royUK
'' website:
'' Purpose : Check if data is Filtered
'' —————————————————————————————
'' —————————————————————————————
'' Procedure: TestFiltered
'' DateTime : 10/10/2005 18:50
'' Amende: 02/07/2016
'' Author: royUK
'' website:
'' Purpose : Check if data is Filtered
'' —————————————————————————————
Function TestFiltered(rng As Range) As Boolean
Dim rngFilter As Range
Dim r As Long, f As Long
Set rngFilter = rng.Parent.AutoFilter.Range
r = rngFilter.Rows.Count
On Error Resume Next
f = rngFilter.SpecialCells(xlCellTypeVisible).Rows.Count
On Error GoTo 0
TestFiltered = r > f
End Function
Sub TestFunction()
MsgBox TestFiltered(ActiveCell)
End Sub
The sample includes using the UDF in an IF function
Posted : 03/07/2016 9:08 am
Page 2 / 2
Prev