Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
On a large sheet with data I have a print button that a user can click. On the sheet I have another button that creates an autofilter. What I would like to have is that if the user selects the print button and NO selection has been made in the autofilter, the routine will exit sub. somethin like : if ActiveSheet.PageSetup.PrintArea = ActiveSheet.AutoFilter.Range.Address is empty then exit sub. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This is from the VBA help:
Remarks This property is True if the worksheet contains a filtered list in which there are hidden rows. Example This example displays the filter status of Sheet1 in a message box. If Worksheets("Sheet1").FilterMode = True Then MsgBox "Filter mode is on" Else MsgBox "Filter mode is off" End If Not sure that's what you're looking for, but thought it might be. Keith "Ixtreme" wrote: Hi, On a large sheet with data I have a print button that a user can click. On the sheet I have another button that creates an autofilter. What I would like to have is that if the user selects the print button and NO selection has been made in the autofilter, the routine will exit sub. somethin like : if ActiveSheet.PageSetup.PrintArea = ActiveSheet.AutoFilter.Range.Address is empty then exit sub. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I know, but that is not what I meant. With this you can only see if
the the autofilter is active. However, what I want is that the user has at least one field selected ie made a filter on 1 field. If not, exit sub. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I see. Try this:
Sub AutoFilterTest() Dim MyFilterCriteria As Boolean MyFilterCriteria = False For Each a In Sheets("Sheet1").AutoFilter.Filters If a.On Then MyFilterCriteria = True Next a If MyFilterCriteria = True Then MsgBox ("Ok to Print.") Else MsgBox ("Not Ok to Print.") End If End Sub And replace my MsgBox ("Ok to Print.") line with the print command you wish to use. Also change "Sheet1" to the name of your sheet. Hope this helps. Keith "Ixtreme" wrote: I know, but that is not what I meant. With this you can only see if the the autofilter is active. However, what I want is that the user has at least one field selected ie made a filter on 1 field. If not, exit sub. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Help adding a condition to a print code | Excel Programming | |||
2007 excel autofilter change back to 2003 autofilter? | Excel Discussion (Misc queries) | |||
Can't We Set Print Area with condition? | Excel Worksheet Functions | |||
lookup with multiple condition, but one condition to satisfy is en | Excel Worksheet Functions | |||
How to print all criterions of filter at AutoFilter | Excel Programming |