#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 172
Default Copy filtered data

I have a worksheet that I want to be able to cut and paste into a new file.
But I only want to be able to cut and paste the filtered rows. How would I go
about creating this macro/vba code to cut and paste only the rows that are
filtered and create a new file with just these rows?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,173
Default Copy filtered data

Secret Squirrel

The trick is to copy it. The code below filters columnA for a value greater
than 600, copies the column (You may want to limit this to the last cell in
your data and the copies it to another sheet, Sheet2, starting in A1

Sub PasteFilteredRows()
Range("A1").AutoFilter Field:=1, Criteria1:="600"
Columns("A:A").Copy Destination:=Worksheets("Sheet2").Range("A1")
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
www.nickhodge.co.uk


"Secret Squirrel" wrote in
message ...
I have a worksheet that I want to be able to cut and paste into a new file.
But I only want to be able to cut and paste the filtered rows. How would I
go
about creating this macro/vba code to cut and paste only the rows that are
filtered and create a new file with just these rows?


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 663
Default Copy filtered data

Hi,

Use this procedure, to retireve all data even if they are mispled when the
data is typed. Then copy this data to a different sheet.

Yes: Specify this procedure for two different ranges:

I can recommend that you copy all the columns to a single excle sheet. This
is basicall to run an advance query which will fetch you all the information
for you to compare. I shall explain you how to do it.

Assuming that you have copied all the columns to a single spread sheet, you
know the column heading now, save the excel sheet.

Now I wiil be using the Advance filtering techniques so that all the column
information are retrieved even if the typed cells are misspelled, which
normally is not the case when you do a simple filtering technique. The
filtered values may not be correct.

To retieve the values;

1. Select all records and the column headings and define a name for the
range List. This is the List range name.
2. Select all column headings and paste in a seperate row anywhere in the
spreadsheet.
2. Select the pasted column heading along with an empty row and define a
name. This is the criteria range name.
3. Define a criteria on the second row for all columns, if necessary. For
example S* will display all details specific to "S'.
4. Click Data- Filter- Advanced Filter
5. Type the List name
6. Type the Criteria Name
7. Click copy to another location option - Mandatory
8. Click Copy to
9. Click the cell below the criteria range

All data will be displayed specific to the query you requested. This is very
usefull if the spreadsheet data are mistyped or mis-spelled. Now you have
done a database funtion on your excle spread sheet.

Challa Prabhu


"Secret Squirrel" wrote:

I have a worksheet that I want to be able to cut and paste into a new file.
But I only want to be able to cut and paste the filtered rows. How would I go
about creating this macro/vba code to cut and paste only the rows that are
filtered and create a new file with just these rows?

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 172
Default Copy filtered data

Hi Nick,
Thanks for the info. I do have a follow up question. I also have a summary
worksheet that I use to summarize specific data from my detail worksheet. On
my summary sheet I have a pull down list for my vendors. How could I write
the code to only copy the rows from the detail sheet that match the vendor on
my summary sheet? The pull down list is in cell B3 on my summary sheet. What
I would want to happen is have the user click a command button and have it
only copy the rows of data from the detail sheet that match that specific
vendor in cell B3. The vendor name is on the detail sheet in column B. I
have 9 columns on my detail sheet. I would want all those columns copied for
the specified vendor. What do you think?

SS

"Nick Hodge" wrote:

Secret Squirrel

The trick is to copy it. The code below filters columnA for a value greater
than 600, copies the column (You may want to limit this to the last cell in
your data and the copies it to another sheet, Sheet2, starting in A1

Sub PasteFilteredRows()
Range("A1").AutoFilter Field:=1, Criteria1:="600"
Columns("A:A").Copy Destination:=Worksheets("Sheet2").Range("A1")
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
www.nickhodge.co.uk


"Secret Squirrel" wrote in
message ...
I have a worksheet that I want to be able to cut and paste into a new file.
But I only want to be able to cut and paste the filtered rows. How would I
go
about creating this macro/vba code to cut and paste only the rows that are
filtered and create a new file with just these rows?



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
copy and paste filtered data Churley Excel Discussion (Misc queries) 6 September 4th 07 04:17 PM
How to copy just the filtered data? ljCharlie Excel Discussion (Misc queries) 3 February 16th 07 06:38 PM
Copy auto filtered data edinclimb Excel Discussion (Misc queries) 0 January 3rd 06 06:36 PM
Copy filtered data Hans Knudsen Excel Discussion (Misc queries) 3 November 25th 05 01:29 PM
How do I copy a filtered subset of data to another worksheet? sftwrqn Excel Discussion (Misc queries) 2 June 30th 05 02:17 PM


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