Run VBA code automatically after running a filter

后端 未结 3 1913
北荒
北荒 2021-01-14 11:27

I\'ve got a code written that categorizes employees along with their qualifications. In order to weed out employees with unwanted qualifications I have applied a filter to e

3条回答
  •  难免孤独
    2021-01-14 12:05

    The key points from my article Trapping a change to a filtered list with VBA

    There is more detail and a sample file with the article, the key points are summarised below

    1. A "dummy" WorkSheet is added with a single SUBTOTAL formula in A1 pointing back to the range being filtered on the main sheet.
    2. A Worksheet_Calculate() Event is added to the "dummy" WorkSheet, this Event fires when the SUBTOTAL formula updates when the filter is changed.

    The next two setps are needed if it is desired to run the Workbook Calculation as Manual

    1. Add a Workbook_Open Event to set the EnableCalculation property of all sheets other than "Dummy" to False.
    2. Run the Workbook in Calculation mode

提交回复
热议问题