mardi 25 septembre 2018

VBA Filter Based on Checked Boxes

I was wondering if anyone could help me out. I have created a user form that changes the filters on an excel sheet. I have column that contains a priority level from 1-3. When the form is launched i have a option to print the report to PDF, but i want to allow the user to apply/filter out result based on the priority, before they print to PDF. I have three check boxes that i want to use in a filter code (See image below). This where i get stuck, i am not sure how to input code into the Criteria portion so when the user would check the box priority 1, it would filter out that section before it prints. I was going to assign the numerical value that is associated with priority if the value is true. Then use that number as the value "criteria" when the filter is applied. Is there a better way to do this?

ActiveSheet.Range("$W$7:$AG$4501").AutoFilter Field:=6, Criteria:= "What Do i Put Here?" 

enter image description here

enter image description here




Aucun commentaire:

Enregistrer un commentaire