How-to refresh Autofilter through Macro in Spreadsheets

Hi,

Could you please let me know how can I set up similar macro in ONLYOFFICE? Or is this possible to do it in the UI?

I couldn’t find any similar functions to it, and I had no luck going through the documentation.

I use this to refresh the filter when a calculation is done to show/hide rows.

Private Sub Worksheet_Change(ByVal Target As Range)
    ActiveSheet.ListObjects(1).AutoFilter.ApplyFilter
End Sub

Sub RefreshFilter()
    ActiveSheet.ListObjects(1).AutoFilter.ApplyFilter
End Sub

Hello @marcel :wave:

Could you please clarify what exactly happens when the macro is executed? Does it simply refresh the filter after calculations, or does it trigger any specific behavior?

If possible, please provide a document and/or a video demonstrating the expected behavior. This will help us better understand your request.

In the meantime, you might find this method useful for updating data on the worksheet:
Recalculate Worksheet Values

A ListObject are complete data structures representing a Table object.

The AutoFilter.ApplyFilter method refreshes the filter view after a change in data.

Say for example we have a filter where status == "Pending" and the user changed a status of an item to “Done”.

The AutoFilter.ApplyFilter method ensures that the filtered view doesn’t show this newly updated item with status “Done” since it doesn’t pass the filter criteria.

1 Like