Forum Discussion

CookysLady's avatar
CookysLady
Copper Contributor
Feb 21, 2021

Auto Update of Filters

I have a combo box on page 1

On page 2 the value of the selection from page 1 is in a cell.

Other cells then refer to it and return either 1 or 0 depending on the value selected. 

These values are in a column and the auto-filter is set to 1.

Each time I select a value in page 1 and go to page 2 I need to press the auto-filter to get the data to change.

 

I would like this to change automatically when the selection is made on page 1.  Excel is configured to auto-calculate.

 

Please can anyone help me with this?

 

Thank you,

Marilyn

5 Replies

  • JMB17's avatar
    JMB17
    Bronze Contributor

    CookysLady 

     

    Try this. Right click on your worksheet tab that has your autofilter, select view code, and past this into the code window that appears. Then, close the vba window.

    Private Sub Worksheet_Calculate()
         On Error Resume Next
         Application.EnableEvents = False
         Me.AutoFilter.ApplyFilter
         Application.EnableEvents = True
    End Sub

     

    • sidedoorsammy's avatar
      sidedoorsammy
      Copper Contributor
      So I typed this out into one of my sheets with a filter and it worked perfectly. I then copied it into all of my other sheets with filters and the other ones won’t work. Any clues?
      • JMB17's avatar
        JMB17
        Bronze Contributor
        Without details, I'm afraid not. If the workbook doesn't have any sensitive information, or an example of what you're working with, could be uploaded, it would be helpful (click on 'open full text editor' and you should see the option to upload a workbook). If that's not possible, then perhaps elaborate more regarding how your data is set up and what you're trying to do (perhaps screenshots if possible and not sensitive information).
    • CookysLady's avatar
      CookysLady
      Copper Contributor

      JMB17 

       

      Thank you so much.  🙂

       

      I ended up creating blocks of data for each filter option then using a lookup formula.  It worked OK but what a job to do!

  • NikolinoDE's avatar
    NikolinoDE
    Platinum Contributor

    CookysLady 

    With your permission, if I can recommend. It can help us all if you upload an Excel file (without sensitive data), no picture. Even if it is said that a picture can say a thousand words, it is certainly not in the case of Excel, on the contrary in some cases. This would also be a blessing for all of us, as we can understand the problem much better, a win-win situation for everyone.

    * Knowing the Excel version and operating system would also be an advantage.

     

    Thank you for your understanding and patience

     

    Nikolino

    I know I don't know anything (Socrates)

     

Resources