ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   AutoFilter (https://www.excelbanter.com/excel-programming/289263-autofilter.html)

jacqui[_2_]

AutoFilter
 
Can anyone help with the VBA syntax for the following
autofilter. I've written the code below which is fine
provided I just wish to filter on criteria1. (The vChanArr
(n) represents a reporting type of which there can be 10.)

Sheets("Data").Range("DatArea").AutoFilter _
Field:=3, Criteria1:=vChanArr(n)

However, in field 2 of my DatArea range is something I
refer to as a Datatype. This entry can either be a Y or a
M. These signify whether the data is Year to date or
Month of. How would I filter on both the vChannArr plus
my datatype of either Y or M.
I'd greatly appreciate any help.
Many thanks
Jacqui

No Name

AutoFilter
 
Hi,

I had a problem like this, but instead of using the
AutoFilter, I used the Advanced Filter. If you set up a
criteria range then you can enter the values into that
range boefore applying the advanced filter.

I can't remember the code for it, but if you just record
it, excel will write the best part of it for you.


-----Original Message-----
Can anyone help with the VBA syntax for the following
autofilter. I've written the code below which is fine
provided I just wish to filter on criteria1. (The

vChanArr
(n) represents a reporting type of which there can be 10.)

Sheets("Data").Range("DatArea").AutoFilter _
Field:=3, Criteria1:=vChanArr(n)

However, in field 2 of my DatArea range is something I
refer to as a Datatype. This entry can either be a Y or

a
M. These signify whether the data is Year to date or
Month of. How would I filter on both the vChannArr plus
my datatype of either Y or M.
I'd greatly appreciate any help.
Many thanks
Jacqui
.


Jim Becker

AutoFilter
 
If I understand your question correctly:

With Sheets("Data").Range("DatArea")
.AutoFilter Field:=2, Criteria1:="Y"
.AutoFilter Field:=3, Criteria1:=vChanArr(n)
End With

--
Hope this helps,
James dot Becker at NCR dot com
~
~
~
:wq!

"jacqui" wrote in message
...
Can anyone help with the VBA syntax for the following
autofilter. I've written the code below which is fine
provided I just wish to filter on criteria1. (The vChanArr
(n) represents a reporting type of which there can be 10.)

Sheets("Data").Range("DatArea").AutoFilter _
Field:=3, Criteria1:=vChanArr(n)

However, in field 2 of my DatArea range is something I
refer to as a Datatype. This entry can either be a Y or a
M. These signify whether the data is Year to date or
Month of. How would I filter on both the vChannArr plus
my datatype of either Y or M.
I'd greatly appreciate any help.
Many thanks
Jacqui





All times are GMT +1. The time now is 04:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com