View Single Post
  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default

You could make your formula look like:

=filtercriteria(A1)&TEXT(RAND(),"")

or you could add "application.volatile" to your code.

Option Explicit
Function FilterCriteria(Rng As Range) As String
'By Stephen Bullen via j-walk.com
Application.Volatile
Dim Filter As String

But the bad thing is that either way, the formula won't recalculate until excel
recalculates.

Hit F9 to force a recalc before you trust the value in the cell.

Dennis wrote:

Using XL 2003 & 2000

OK, with help, I was able to utilize Steve Bullen's FilterCriteria() Function.

That said, apparently the only way to refresh the data in the display cell
is to re-activate the formula by pressing <ENTER in the Fx Box.

Can the display cells be made to refresh in real-time or, second best, by F9?

FYI (Background Info):

************************************************** **********II placed this
formula into cell A1: =FilterCriteria(A3)
Cell A3 contains the Autofilter down-arrow for column A
************************************************** ***********
Function FilterCriteria(Rng As Range) As String
'By Stephen Bullen via j-walk.com
Dim Filter As String
Filter = ""
On Error GoTo Finish
With Rng.Parent.AutoFilter
If Intersect(Rng, .Range) Is Nothing Then GoTo Finish
With .Filters(Rng.Column - .Range.Column + 1)
If Not .On Then GoTo Finish
Filter = .Criteria1
Select Case .Operator
Case xlAnd
Filter = Filter & " AND " & .Criteria2
Case xlOr
Filter = Filter & " OR " & .Criteria2
End Select
End With
End With
Finish:
FilterCriteria = Filter
End Function
************************************************** ***********

Also, why does this formula not refresh as do other formulas in the
worksheet? Is it because this particlar Function must be "force-called" for
each refresh?

TIA Dennis


--

Dave Peterson