vendredi 22 avril 2016

Use Checkboxes to Toggle Filter

I am working in Excel 2010. I'd like to add three checkboxes to the top of my sheet that when checked, drive an auto filter to filter the rows accordingly. I understand that this could simply be done within the Autofilter, but I have a conditional format on the column that simply changes the data to symbols.

I added three check boxes to top of my for - "Current", "Pending", and "Expired". I then created 6 macro's in the sheet for each of the selections within the auto filter.

Here's my code:

Sub CheckBox_Click()
  Select Case CB_Click
    Case Current = True
        Call Macro1
    Case Current = True And Pending = True
        Call Macro2
    Case Current = True And Pending = True And Expired = True
        Call Macro3
    Case Pending = True
        Call Macro4
    Case Pending = True And Expired = True
        Call Macro5
    Case Expired = True
        Call Macro6
    Case Else
        Call Macro3
  End Select
End Sub

My sub routines are labeled correctly. I'm getting a 'Expected Variable or Procedure, not a module' error. Any ideas?

Thanks Joe




Aucun commentaire:

Enregistrer un commentaire