Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello I have a sheet which contains a large amount of data, this data is
broken down into different departments; the departments are known by the first two numbers, so 16000 is department A and 17000 is department B. For examples sake I have three buttons, one button allows you to view the sheet with everything unfiltered, one button is just to filter out everything but 16 and the other to just display 17. At the moment I'm doing it with the following VBA Code - Private Sub filterSheet(dep As Integer, sht As String) Sheets(sht).Select Columns("A:M").Select Selection.AutoFilter Selection.AutoFilter Field:=1, Criteria1:="=" & dep & "0000", Operator:=xlAnd, Criteria2:="<" & dep + 1 & "0000" End Sub This does what I want it to, but the problem comes with the line Selection.AutoFilter Because the button that takes me to the sheet to view ALL the departments, doesn't use an Autofilter, yet the BACK button on this sheet uses the line Selection.Autofilter to disable the autofilter and if it's not been set then I get a problem where it becomes disabled when it should be active. I'm just wondering if there is a way to specify Autofilter = False or something like that? I do hope that made some sense, as I think it gets quite muddled towards the middle :) Thanks for any help in advance! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
excel 2007 autofilter change to 2003 autofilter functionality? | Excel Discussion (Misc queries) | |||
2007 excel autofilter back to 2003 autofilter? | Excel Discussion (Misc queries) | |||
2007 excel autofilter change back to 2003 autofilter? | Excel Discussion (Misc queries) | |||
2007 Autofilter worse than 2003 Autofilter | Excel Discussion (Misc queries) | |||
How to Sort within AutoFilter with Protection on (and AutoFilter . | Excel Discussion (Misc queries) |