Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default Autofilter copy

I have a fixed size table of data to autofilter. The data range is
Worksheets("DS Analysis").Range("A1:E25"). Row 1 is headers eg.,
DS Port, 2 Wk Max, %, 2 Wk Avg, %. I need to do 2 separate filter/copy/paste
of values and formats to 2 different destinations. The first filter criteria
is Field:=3, Criteria1:="=.85". The filtered results from columns A, B, & C
need pasted to G1 (includes headers). The 2nd filter criteria is to ShowAll
on field 3, then Field:=5, Criteria1:="=.75". The filtered results from
Columns A, D, & E need pasted to J1 (includes headers).
I would like to do this without .Selection if possible, and avoid copy/paste
of entire columns to keep the .UsedRange to a minimum.
Thanks for any code you could provide

Mike F


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Autofilter copy

I would think recording a macro when you do this manually would get you close to
the code you want.

If you try it and have trouble, post back.



Mike Fogleman wrote:

I have a fixed size table of data to autofilter. The data range is
Worksheets("DS Analysis").Range("A1:E25"). Row 1 is headers eg.,
DS Port, 2 Wk Max, %, 2 Wk Avg, %. I need to do 2 separate filter/copy/paste
of values and formats to 2 different destinations. The first filter criteria
is Field:=3, Criteria1:="=.85". The filtered results from columns A, B, & C
need pasted to G1 (includes headers). The 2nd filter criteria is to ShowAll
on field 3, then Field:=5, Criteria1:="=.75". The filtered results from
Columns A, D, & E need pasted to J1 (includes headers).
I would like to do this without .Selection if possible, and avoid copy/paste
of entire columns to keep the .UsedRange to a minimum.
Thanks for any code you could provide

Mike F


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default Autofilter copy

I was having trouble with getting the non-contiguous columns A, D,E.
Sub DSFilter()
Dim srng As Range, drng As Range

Set srng = Worksheets("DS Analysis").Range("A1:E25")
Set drng = Worksheets("DS Analysis").Range("G1")

With srng
.AutoFilter field:=3, Criteria1:="=.85"
.Columns("A:C").SpecialCells(xlVisible).Copy Destination:=drng
.AutoFilter field:=3
.AutoFilter field:=5, Criteria1:="=.75"
.Range("A:A,D:E").SpecialCells(xlVisible).Copy
Destination:=drng.Offset(0, 3)
.AutoFilter
End With
End Sub

until I realized that they must now be .Range not .Columns("A, D:E")
thnx
Mike F
"Dave Peterson" wrote in message
...
I would think recording a macro when you do this manually would get you
close to
the code you want.

If you try it and have trouble, post back.



Mike Fogleman wrote:

I have a fixed size table of data to autofilter. The data range is
Worksheets("DS Analysis").Range("A1:E25"). Row 1 is headers eg.,
DS Port, 2 Wk Max, %, 2 Wk Avg, %. I need to do 2 separate
filter/copy/paste
of values and formats to 2 different destinations. The first filter
criteria
is Field:=3, Criteria1:="=.85". The filtered results from columns A, B,
& C
need pasted to G1 (includes headers). The 2nd filter criteria is to
ShowAll
on field 3, then Field:=5, Criteria1:="=.75". The filtered results from
Columns A, D, & E need pasted to J1 (includes headers).
I would like to do this without .Selection if possible, and avoid
copy/paste
of entire columns to keep the .UsedRange to a minimum.
Thanks for any code you could provide

Mike F


--

Dave Peterson



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Autofilter copy

How about just doing it steps:

Option Explicit
Sub DSFilter()
Dim srng As Range, drng As Range

Set srng = Worksheets("DS Analysis").Range("A1:E25")
Set drng = Worksheets("DS Analysis").Range("G1")

With srng
.AutoFilter Field:=3, Criteria1:="=.85"
.Columns("A:C").SpecialCells(xlVisible).Copy _
Destination:=drng

.AutoFilter Field:=3

.AutoFilter Field:=5, Criteria1:="=.75"
.Range("A:A").SpecialCells(xlVisible).Copy _
Destination:=drng.Offset(0, 3)
.Range("D:e").SpecialCells(xlVisible).Copy _
Destination:=drng.Offset(0, 4)

.AutoFilter
End With
End Sub




Mike Fogleman wrote:

I was having trouble with getting the non-contiguous columns A, D,E.
Sub DSFilter()
Dim srng As Range, drng As Range

Set srng = Worksheets("DS Analysis").Range("A1:E25")
Set drng = Worksheets("DS Analysis").Range("G1")

With srng
.AutoFilter field:=3, Criteria1:="=.85"
.Columns("A:C").SpecialCells(xlVisible).Copy Destination:=drng
.AutoFilter field:=3
.AutoFilter field:=5, Criteria1:="=.75"
.Range("A:A,D:E").SpecialCells(xlVisible).Copy
Destination:=drng.Offset(0, 3)
.AutoFilter
End With
End Sub

until I realized that they must now be .Range not .Columns("A, D:E")
thnx
Mike F
"Dave Peterson" wrote in message
...
I would think recording a macro when you do this manually would get you
close to
the code you want.

If you try it and have trouble, post back.



Mike Fogleman wrote:

I have a fixed size table of data to autofilter. The data range is
Worksheets("DS Analysis").Range("A1:E25"). Row 1 is headers eg.,
DS Port, 2 Wk Max, %, 2 Wk Avg, %. I need to do 2 separate
filter/copy/paste
of values and formats to 2 different destinations. The first filter
criteria
is Field:=3, Criteria1:="=.85". The filtered results from columns A, B,
& C
need pasted to G1 (includes headers). The 2nd filter criteria is to
ShowAll
on field 3, then Field:=5, Criteria1:="=.75". The filtered results from
Columns A, D, & E need pasted to J1 (includes headers).
I would like to do this without .Selection if possible, and avoid
copy/paste
of entire columns to keep the .UsedRange to a minimum.
Thanks for any code you could provide

Mike F


--

Dave Peterson


--

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
Insert Row/Copy with Autofilter lilbit3684 Excel Discussion (Misc queries) 4 April 3rd 07 11:17 PM
autofilter copy to new range Monique Excel Programming 3 July 19th 05 09:39 PM
AutoFilter and copy Rich[_16_] Excel Programming 2 September 27th 04 09:48 PM
AUTOFILTER copy and paste RJ Kelly Excel Programming 1 June 8th 04 11:40 AM
Copy an autofilter range pauluk[_13_] Excel Programming 2 March 4th 04 04:28 PM


All times are GMT +1. The time now is 11:07 AM.

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

About Us

"It's about Microsoft Excel"