Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Autofilter turn off with macro

Another macro question about the autofilter!

I have a macro as below that filters my worksheet to only show rows where
there is a value in column C and outputs it to the print preview screen.
When you close the preview screen the print range is selected and the filter
is still on.

Is there anyway of editing the macro so that when you close the print
preview screen the worksheet has no selection or filter?

The Macro:

Sub setprintarea()

Range("A14:j65536").Select
Selection.AutoFilter
Selection.AutoFilter Field:=3, Criteria1:="<"
Columns("A:j").Select
Range("A2").Activate
Selection.PrintOut Copies:=1, Preview:=True, Collate:=True

End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Autofilter turn off with macro

AutoFilter toggles; so just add another:

Range("A14:j65536").Select
Selection.AutoFilter

at the end
--
Gary''s Student - gsnu200848


"Shaggyjh" wrote:

Another macro question about the autofilter!

I have a macro as below that filters my worksheet to only show rows where
there is a value in column C and outputs it to the print preview screen.
When you close the preview screen the print range is selected and the filter
is still on.

Is there anyway of editing the macro so that when you close the print
preview screen the worksheet has no selection or filter?

The Macro:

Sub setprintarea()

Range("A14:j65536").Select
Selection.AutoFilter
Selection.AutoFilter Field:=3, Criteria1:="<"
Columns("A:j").Select
Range("A2").Activate
Selection.PrintOut Copies:=1, Preview:=True, Collate:=True

End Sub


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Autofilter turn off with macro


How about this?

Sub setprintarea()
With Range("A14:j65536")
..AutoFilter
..AutoFilter Field:=3, Criteria1:="<"
End With
Columns("A:j").Select
Range("A2").Activate
Selection.PrintOut Copies:=1, Preview:=True, Collate:=True
Range("A1").Select
ActiveSheet.Columns.AutoFilter
End Sub


Shaggyjh;319458 Wrote:
Another macro question about the autofilter!

I have a macro as below that filters my worksheet to only show rows
where
there is a value in column C and outputs it to the print preview
screen.
When you close the preview screen the print range is selected and the
filter
is still on.

Is there anyway of editing the macro so that when you close the print
preview screen the worksheet has no selection or filter?

The Macro:

Sub setprintarea()

Range("A14:j65536").Select
Selection.AutoFilter
Selection.AutoFilter Field:=3, Criteria1:="<"
Columns("A:j").Select
Range("A2").Activate
Selection.PrintOut Copies:=1, Preview:=True, Collate:=True

End Sub



--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=89316

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Autofilter turn off with macro

Many thanks


"Gary''s Student" wrote:

AutoFilter toggles; so just add another:

Range("A14:j65536").Select
Selection.AutoFilter

at the end
--
Gary''s Student - gsnu200848


"Shaggyjh" wrote:

Another macro question about the autofilter!

I have a macro as below that filters my worksheet to only show rows where
there is a value in column C and outputs it to the print preview screen.
When you close the preview screen the print range is selected and the filter
is still on.

Is there anyway of editing the macro so that when you close the print
preview screen the worksheet has no selection or filter?

The Macro:

Sub setprintarea()

Range("A14:j65536").Select
Selection.AutoFilter
Selection.AutoFilter Field:=3, Criteria1:="<"
Columns("A:j").Select
Range("A2").Activate
Selection.PrintOut Copies:=1, Preview:=True, Collate:=True

End Sub


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Autofilter turn off with macro

With worksheets("Sheet9999")
'to remove the filter and the arrows
.AutoFilterMode = False

'or to just show all the data and keep the arrows
If .FilterMode Then
.ShowAllData
End If
End With

Shaggyjh wrote:

Another macro question about the autofilter!

I have a macro as below that filters my worksheet to only show rows where
there is a value in column C and outputs it to the print preview screen.
When you close the preview screen the print range is selected and the filter
is still on.

Is there anyway of editing the macro so that when you close the print
preview screen the worksheet has no selection or filter?

The Macro:

Sub setprintarea()

Range("A14:j65536").Select
Selection.AutoFilter
Selection.AutoFilter Field:=3, Criteria1:="<"
Columns("A:j").Select
Range("A2").Activate
Selection.PrintOut Copies:=1, Preview:=True, Collate:=True

End Sub


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro turn off AutoFilter Erin Excel Worksheet Functions 2 February 26th 08 08:38 PM
Turn of Autofilter Arrows? CLR Excel Programming 20 January 28th 08 11:55 PM
Turn ON Autofilter Filters dcHill Excel Programming 1 June 16th 05 07:53 PM
IF AutoFilter is on, turn it off CLR Excel Programming 14 April 21st 05 03:26 PM
Turn AutoFilter off by code? Ed[_9_] Excel Programming 6 September 24th 03 01:18 AM


All times are GMT +1. The time now is 03:10 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"