Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
copy and paste filtered data | Excel Discussion (Misc queries) | |||
How to copy just the filtered data? | Excel Discussion (Misc queries) | |||
Copy auto filtered data | Excel Discussion (Misc queries) | |||
Copy filtered data | Excel Discussion (Misc queries) | |||
How do I copy a filtered subset of data to another worksheet? | Excel Discussion (Misc queries) |