Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 947
Default How do I copy an autofilter using a macro?

In addition to this excellent idea, if you wish not to copy the Heading Row,
just offset by 1.

Sub Demo()
Dim rngTo As Range

Set rngTo = Sheets(2).Range("A1")

ActiveSheet.AutoFilter.Range. _
Offset(1).Copy rngTo
End Sub

--
HTH :)
Dana DeLouis
Windows XP & Office 2003


"N10" wrote in message
...
Hi

Try this


With code select the filtered range

then use

Selection.SpecialCell(xlCellTypeVisible).Select
Selection.Copy

This copies only the cells visble as a result of the filter criteria

N10 ;)



"Astongizmo" wrote in message
...
Hi - I'm new to macros and the answer to my question is probably already
posted.

I have a spreadsheet containing an autofilter. This always returns the
same
number of columns but the number of rows can vary. I want to copy the
displayed rows only to a second sheet building up a list on the second
sheet,
so each time I select a new filter the result will be copied to the
second
sheet below any data already there. As a second stage I want to sort the
second sheet and extract all rows where a certain column matches a fixed
criteria into a further sheet. This second stage will require to be done
twice as the criteria changes.

Any help will be gratefully received.






  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default How do I copy an autofilter using a macro?

Hi Dana,

Please see my response to N10 - really appreciate your input.

I am a virgin code user so does your section go before or after the code
suggested by N10?

Thanks once again.

"Dana DeLouis" wrote:

In addition to this excellent idea, if you wish not to copy the Heading Row,
just offset by 1.

Sub Demo()
Dim rngTo As Range

Set rngTo = Sheets(2).Range("A1")

ActiveSheet.AutoFilter.Range. _
Offset(1).Copy rngTo
End Sub

--
HTH :)
Dana DeLouis
Windows XP & Office 2003


"N10" wrote in message
...
Hi

Try this


With code select the filtered range

then use

Selection.SpecialCell(xlCellTypeVisible).Select
Selection.Copy

This copies only the cells visble as a result of the filter criteria

N10 ;)



"Astongizmo" wrote in message
...
Hi - I'm new to macros and the answer to my question is probably already
posted.

I have a spreadsheet containing an autofilter. This always returns the
same
number of columns but the number of rows can vary. I want to copy the
displayed rows only to a second sheet building up a list on the second
sheet,
so each time I select a new filter the result will be copied to the
second
sheet below any data already there. As a second stage I want to sort the
second sheet and extract all rows where a certain column matches a fixed
criteria into a further sheet. This second stage will require to be done
twice as the criteria changes.

Any help will be gratefully received.







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 to autofilter other file and copy in opened file matthias Excel Programming 4 August 17th 06 10:52 AM
Questions: Copy ranges, autofilter macro, subtotals, & naming shee Smangler Excel Programming 2 June 11th 06 05:37 PM
Autofilter copy Mike Fogleman Excel Programming 3 December 5th 05 08:23 PM
Copy Autofilter results macro CLR Excel Programming 7 May 16th 05 06:48 PM
AutoFilter and copy Rich[_16_] Excel Programming 2 September 27th 04 09:48 PM


All times are GMT +1. The time now is 09:37 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"