I have two listboxes on a userform, one for year, one for month.
The month is a multiselect box, i.e. user can select more than one month. What I'd like to do is to autofilter the multiple items selected within the listbox onto one column in a sheet. So, it would view entries for Jan, Feb, Mar etc.
The code is easy for one month, but now i'm using multiselect lb I'm stuck. I'm thinking along the lines of an array, but not sure how this would work in defining the length of the array required etc...
Something like this?
The month is a multiselect box, i.e. user can select more than one month. What I'd like to do is to autofilter the multiple items selected within the listbox onto one column in a sheet. So, it would view entries for Jan, Feb, Mar etc.
The code is easy for one month, but now i'm using multiselect lb I'm stuck. I'm thinking along the lines of an array, but not sure how this would work in defining the length of the array required etc...
Something like this?
Code:
With Worksheets("Visits")
.ShowAllData
.range("A1:R1").autofilter field:=17, Criteria1:=Array("x", "y", etc)
'where x and y etc are values in the listbox select
End With