somersault
Board Regular
- Joined
- Jun 24, 2008
- Messages
- 59
Any idea why the below doesnt work in excel 2007??
Original code (as recorded by excel - this works well):
ActiveSheet.Range("$F$4:$G$18").AutoFilter Field:=2, Criteria1:=Array("1", "2", "3"), Operator:=xlFilterValues
Note that 1, 2, 3 are filter selection.
Dyanmic code (to make the filter selection dynamic)
r = sheets("sheet1").range("P2").value
ra = sheets("sheet1").range("P3").value
rb = sheets("sheet1").range("P4").value
ActiveSheet.Range("$F$4:$G$18").AutoFilter Field:=2, Criteria1:=Array(r, ra, rb), Operator:=xlFilterValues
i have defined the filter selections in excel range, and refered to them.
I am unable to find out my mistake, could you help??
Original code (as recorded by excel - this works well):
ActiveSheet.Range("$F$4:$G$18").AutoFilter Field:=2, Criteria1:=Array("1", "2", "3"), Operator:=xlFilterValues
Note that 1, 2, 3 are filter selection.
Dyanmic code (to make the filter selection dynamic)
r = sheets("sheet1").range("P2").value
ra = sheets("sheet1").range("P3").value
rb = sheets("sheet1").range("P4").value
ActiveSheet.Range("$F$4:$G$18").AutoFilter Field:=2, Criteria1:=Array(r, ra, rb), Operator:=xlFilterValues
i have defined the filter selections in excel range, and refered to them.
I am unable to find out my mistake, could you help??