ann t long
New Member
- Joined
- Mar 27, 2020
- Messages
- 3
- Office Version
- 365
- Platform
- Windows
a macro reads the filtering selected by the user of an excel data file. When the user selects from a date column, using the tree list to select years, I can record a macro that simulates what has been selected as:
ActiveSheet.Range("$A$3:$T$179896").AutoFilter Field:=4, Operator:= _
xlFilterValues, Criteria2:=Array(0, "3/20/2020", 0, "12/31/2019", 0, "12/31/2018")
I understand that the zero indicates to use the "year" portion of the date, while generating the filter. However, I am having trouble reading the values that are in the array.
my goal is to regurgitate the selected filter to the user and incorporate it into charts that result from further macro actions.
*statements between asterisks fail*
using:
dim afilt as filter
set afilt = activesheet.autofilter.filters(4)
dim varCri as variant
dim VCri(6) as variant
*varCri = afilt.criteria2*
*VCri = afilt.criteria2*
*msgbox afilt.criteria2(1)*
*msgbox afilt.criteria2(2)*
*msgbox afilt.criteria2(1,1)*
and the filter is "on" and the operator is 7/xlfiltervalues
Thank you for the help.
ActiveSheet.Range("$A$3:$T$179896").AutoFilter Field:=4, Operator:= _
xlFilterValues, Criteria2:=Array(0, "3/20/2020", 0, "12/31/2019", 0, "12/31/2018")
I understand that the zero indicates to use the "year" portion of the date, while generating the filter. However, I am having trouble reading the values that are in the array.
my goal is to regurgitate the selected filter to the user and incorporate it into charts that result from further macro actions.
*statements between asterisks fail*
using:
dim afilt as filter
set afilt = activesheet.autofilter.filters(4)
dim varCri as variant
dim VCri(6) as variant
*varCri = afilt.criteria2*
*VCri = afilt.criteria2*
*msgbox afilt.criteria2(1)*
*msgbox afilt.criteria2(2)*
*msgbox afilt.criteria2(1,1)*
and the filter is "on" and the operator is 7/xlfiltervalues
Thank you for the help.