I was wondering if I could ask for some assistance. I've tried various options and have struggled so will explain and provide the initial code I had put together.
I have a large spreadsheet with multiple columns, the objective is that I would have a form that sits on top of this table and based on certain responses being selected this will eventually populate a list of rows that are applicable once a button is pressed that stores the VBA code. The form is in place and I decided to use AdvancedFilter in VBA where I have criteria below the table where if something matches a particular value (e.g. =A) for that column then that column is filtered on that value (A). I would like to have the same take place for multiple different sets of columns through criteria ranges. I started with the following which works fine for initial list:
Sub Generate()
Range("A15:CG255").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:= _
Range("Y310:AA313"), Unique:=False
'End Sub
I then tried to incorporate the additional criteria but this only returns the filter based on the original list so the number of rows should initially filter down to, for example, 30 and then the new filter should filter this list down to 12 but I get a different number as it calculates the rows matching the second filter.
Sub Generate()
Range("A15:CG255").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:= _
Range("Y310:AA313"), Unique:=False
'Additional filter which was attempted
Range("A15:CG255").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:= _
Range("AE316:AH320"), Unique:=False
End Sub
It seems its running the filter on all the rows and not visible cells, I've tried many variations which seem to break excel and can't seem to find a method that works. Was hoping someone would be able to help!
I have a large spreadsheet with multiple columns, the objective is that I would have a form that sits on top of this table and based on certain responses being selected this will eventually populate a list of rows that are applicable once a button is pressed that stores the VBA code. The form is in place and I decided to use AdvancedFilter in VBA where I have criteria below the table where if something matches a particular value (e.g. =A) for that column then that column is filtered on that value (A). I would like to have the same take place for multiple different sets of columns through criteria ranges. I started with the following which works fine for initial list:
Sub Generate()
Range("A15:CG255").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:= _
Range("Y310:AA313"), Unique:=False
'End Sub
I then tried to incorporate the additional criteria but this only returns the filter based on the original list so the number of rows should initially filter down to, for example, 30 and then the new filter should filter this list down to 12 but I get a different number as it calculates the rows matching the second filter.
Sub Generate()
Range("A15:CG255").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:= _
Range("Y310:AA313"), Unique:=False
'Additional filter which was attempted
Range("A15:CG255").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:= _
Range("AE316:AH320"), Unique:=False
End Sub
It seems its running the filter on all the rows and not visible cells, I've tried many variations which seem to break excel and can't seem to find a method that works. Was hoping someone would be able to help!