Hi,
I found codes by some expert here on regards to select the filtered rows excluding the headers:-
But got 2 situations I need help:-
1. After filtered, the selection supposed to be filtered range from column B until U, but I don't know why the coding above would select from B until V altho V doesn't have any data or header. I tried changing the integer inside bracket Offset and Cells to see the result but still not giving the output I want.
2. I need to autofilter based on 2 criterias before I select the filtered data, which is by month (Field:=20) and then by dept (Field:=10). But when I put extra autofilter code below the first one, the code to select the filtered data will prompt an error. But I still need this code in order to auto select the first filtered data which could vary based on the month and the dept.
Appreciate some help.
Thank you very much in advance.
DZ
I found codes by some expert here on regards to select the filtered rows excluding the headers:-
Code:
Dim aRng As Range
ActiveSheet.Range("$B$4:$U$" & Rows.Count).AutoFilter Field:=20, Criteria1:="Jan"
Set aRng = ActiveSheet.AutoFilter.Range.Offset(1).SpecialCells(xlCellTypeVisible).Cells(1, 1).CurrentRegion 'aRng also contains the header row
Set aRng = aRng.Offset(1, 1).Resize(aRng.Rows.Count - 1) 'and now it doesn't
aRng.Select
Selection.Copy
But got 2 situations I need help:-
1. After filtered, the selection supposed to be filtered range from column B until U, but I don't know why the coding above would select from B until V altho V doesn't have any data or header. I tried changing the integer inside bracket Offset and Cells to see the result but still not giving the output I want.
2. I need to autofilter based on 2 criterias before I select the filtered data, which is by month (Field:=20) and then by dept (Field:=10). But when I put extra autofilter code below the first one, the code to select the filtered data will prompt an error. But I still need this code in order to auto select the first filtered data which could vary based on the month and the dept.
Appreciate some help.
Thank you very much in advance.
DZ