mehaffey
New Member
- Joined
- Oct 25, 2024
- Messages
- 1
- Office Version
- Prefer Not To Say
- Platform
- Windows
I have inherited an Excel workbook that has several pages with buttons for macros to filter the data on various sets of criteria. This is the specific code I am working with below and the entire workbook follows the same pattern.
The head of the specific module and the filter code look like this:
Obviously the code for AddCriteria Array for >0.03 and <0.97 only shows rows for the <0.97 condition. Is there a way/syntax for Filter.AddCriteria that will do this AND/between logic?
Thank you for your time!
The head of the specific module and the filter code look like this:
VBA Code:
Public Function SetupVariant() As Collection
Dim allFilters As Collection, Filter As FilterDefinition
Dim ws As Worksheet
Set ws = ThisWorkbook.Sheets("Variants")
' create a main list of filters
Set allFilters = New Collection
' Test filter
Set Filter = New FilterDefinition
Filter.Init "Variants", "Candidates", "Alt Reads > 10, 0.3 < VAF < 0.97"
Filter.AddCriteria "Alt Reads", ">10"
Filter.AddCriteria "VAF", Array(">0.03","<0.97")
allFilters.Add Filter
Obviously the code for AddCriteria Array for >0.03 and <0.97 only shows rows for the <0.97 condition. Is there a way/syntax for Filter.AddCriteria that will do this AND/between logic?
Thank you for your time!