Alternate to Sheet_Calc when Filter applied.
You can use a worksheet change function. I assume the filter you are
refereing to is autofilter. Make the target cell in the worksheet change
the location if the autofilter box
Private Sub Worksheet_Change(ByVal Target as Range)
if not application.intersect(target,Range("C1")) is nothing then
'enter you code here
end if
End Sub
"Trevor Williams" wrote:
Hi All
I'm using the Worksheet_Calculate event to show/hide 2 images on the active
sheet when a filter is applied. The issue is that the event fires whether
I'm on the sheet or not.
My question then is: Is there an alternate way I can show/hide the images
without using the Worksheet_Calculate event when a filter is applied?
Code below
Thanks in advance
Trevor Willams
'Worksheet module
Private Sub Worksheet_Calculate()
Call ShowClearFilterButton
End Sub
'Code Module
Sub ShowClearFilterButton()
With ActiveSheet
On Error Resume Next
If .AutoFilterMode = True Then
If .FilterMode = True Then
.Shapes("picFilter").Visible = msoTrue
.Shapes("btnFilter").Visible = msoTrue
Else
.Shapes("picFilter").Visible = msoFalse
.Shapes("btnFilter").Visible = msoFalse
End If
End If
End With
End Sub
|