ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Filter event (https://www.excelbanter.com/excel-programming/443033-filter-event.html)

jodleren

Filter event
 
Hi all

How can I catch a filter event?

I found, that there is no such event, but I rely on, that someone has
invented something...

WBR
Sonnich

jodleren

Filter event
 
On Jun 2, 8:04*pm, jodleren wrote:
Hi all

How can I catch a filter event?

I found, that there is no such event, but I rely on, that someone has
invented something...

WBR
Sonnich


Well, I came up with this:

Private Sub Workbook_SheetCalculate(ByVal Sh As Object)
Dim iHidden, iRow As Integer
Dim ws As Worksheet

If Worksheets("BOM").Cells(1, 28).Value = "" Then
Worksheets("BOM").Cells(1, 28).Value = "X" // check whether we
are running
Application.ScreenUpdating = False
Application.DisplayAlerts = False

With Worksheets("BOM")
' find plase to store hidden data
iHidden = 1
While .Cells(6, iHidden).Text < ""
iHidden = iHidden + 1
Wend

iRow = 7
While .Cells(iRow, 1).Value < ""
If .Cells(iRow, iHidden).Value < "" Then // if row is marked,
then hide it
.Rows(iRow).Hidden = True
End If
iRow = iRow + 1
Wend
End With

Application.ScreenUpdating = True
Application.DisplayAlerts = True
Worksheets("BOM").Cells(1, 28).Value = "" // we are done
End If
End Sub


All times are GMT +1. The time now is 09:58 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com