+ Reply to Thread
Results 1 to 10 of 10

Transfering large amounts of autofiltered data to new worksheet

  1. #1
    Registered User
    Join Date
    07-11-2008
    Location
    Toronto
    Posts
    50

    Transfering large amounts of autofiltered data to new worksheet

    Hello everyone, I have a problem with my current macro that uses a basic autofilter to auto filter from the parent database to extract the correct rows and then copies the query and pastes it into a new worksheet to further proceed with the macro.

    I have run into a problem because my database has become very big and now when I try to autofilter the query and click on copy, an error regarding the data range reference is too complex - use data that can be selected in one contiguous rectangle

    I tried a few things such as to autofilter out everything I dont need and hit delete - this does not work either, same result

    I got help here previously in which the code deletes All Hidden Rows and this is very time consuming, I have not tested all my methods but it took 15 minutes to delete hidden files for one method and theres roughly 5 in total

    I have to end up running this code on the parent worksheet multiple times because I use the parent worksheet to extract different parameters into different worksheets!

    I have noticed that if I manually copy the data in smaller blocks, by halving the data seems to work,but I do not know how large of a partition I am limited to copy because my database is very large and the size varies month-to-month so I cannot put a number on the max range. I think if I could get a macro to do it by thirds or preferably quarter range should be safe.


    So just to summarize, I am trying to devise a method in which I would auto filter on the active parent sheet "sheet 1" and I would copy the auto-filtered query to "sheet2" instead of copying the whole worksheet in one instance I would like to split the autofitlered query into four equal parts with respect to the range of the worksheet and then to copy the first quarter of the query and paste in sheet 2 and then the second quarter to sheet 2 and so on untill all four quarters are done one after the other, so sheet 2 should be a series of all four parts combined into one series on sheet2



    Any help is appreciated!
    Last edited by opg; 02-10-2009 at 02:56 PM.

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Transfering large amounts of autofiltered data to new worksheet

    Hi

    Have you tried using the advanced filter and directing the output to the second sheet rather than trying to copy paste?

    rylo

  3. #3
    Registered User
    Join Date
    07-11-2008
    Location
    Toronto
    Posts
    50

    Re: Transfering large amounts of autofiltered data to new worksheet

    Quote Originally Posted by rylo View Post
    Hi

    Have you tried using the advanced filter and directing the output to the second sheet rather than trying to copy paste?

    rylo
    Hi, I was unsuccessful at trying this because I was unable to make it work using Advanced FIlter, for example,


    How would I filter out Alpha,Alphabet (previously used equals Alpha* statement using Autofilter) out of column F and transfer to say, sheet7 ?

  4. #4
    Valued Forum Contributor Richard Schollar's Avatar
    Join Date
    05-23-2006
    Location
    Hampshire UK
    MS-Off Ver
    Excel 2002
    Posts
    1,264

    Re: Transfering large amounts of autofiltered data to new worksheet

    Quote Originally Posted by opg View Post
    Hi, I was unsuccessful at trying this because I was unable to make it work using Advanced FIlter, for example,


    How would I filter out Alpha,Alphabet (previously used equals Alpha* statement using Autofilter) out of column F and transfer to say, sheet7 ?
    Hi

    Is the parent database contained within an Excel file? I would potentially consider using a separate workbook to query the database using Data>Get External Data (or by using a code solution eg with ADO) as this won't suffer from the same limitations.

    Note that I rarely use AdvancedFilter on large datasets simply because I find it incredibly slow when there is a lot of data (it raises my blood pressure waiting for it to run and significantly endagers the continued wellbeing of my computer!).

    Richard
    Richard Schollar
    Microsoft MVP - Excel

  5. #5
    Registered User
    Join Date
    07-11-2008
    Location
    Toronto
    Posts
    50

    Re: Transfering large amounts of autofiltered data to new worksheet

    Hi, to answer your question, all the content is in one excel file, I actually retrieve the parent database in a separate excel file and copy-> paste it into the main worksheet in the workbook.I am all for the export feature if that helps!
    Last edited by opg; 02-11-2009 at 02:58 PM.

  6. #6
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Transfering large amounts of autofiltered data to new worksheet

    Hi

    To use advanced filter to copy to another sheet.

    1) Sheet1 columns A:F has your data with headings in row 1.
    2) Sheet7:A1:F1 have the same headings.
    3) Sheet7:H1 has the same heading as F1
    4) Sheet7:H2 has "Alpha*"
    5) Highlight Sheet7!A1:F1 then
    filter, advanced filter, go through the message about the headings, then fill out the 3 items List range (by going to sheet1), Criteria range (H1:H2) and output range A1:F1 (both on the output sheet).

    This should filter the data from sheet1 and output to sheet7

    rylo
    Last edited by rylo; 02-13-2009 at 05:20 PM.

  7. #7
    Registered User
    Join Date
    07-11-2008
    Location
    Toronto
    Posts
    50

    Re: Transfering large amounts of autofiltered data to new worksheet

    Hi rylo, I would like to inform you that I have data upto column I so instead of using column H as in your steps I used column K, I tried many different ways and the prompt I keep getting is,

    This command requires at least two rows of source data. You cannot use the command on a selection in only one row. Try the following

    -If you're using an advance filter, select a range of cells that contains atleast two rows of data. Then click the Advanced filter comand again


    ) Highlight Sheet7!A1:F1 then
    filter, advanced filter, go through the message about the headings, then fill out the 3 items List range (by going to sheet1), Criteria range (H1:H1) and output range A1:F1.

    This should filter the data from sheet1 and output to sheet7
    Im trying to follow this step right here, I highlight A1:I1 on sheet 7 and go to Advanced Filter
    -Select copy to another location
    -List Range: I click in the text box and then I click on Sheet1 tab and select A1:I1
    -Criteria Range: I click on the text box which takes me to Sheet7 and then I clik on the K1 cell

    -Copy to: I click on the text box and then click on Sheet7 and proceed to select cells A1:I1


    this does not seem to work
    Last edited by opg; 02-12-2009 at 11:59 AM.

  8. #8
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Transfering large amounts of autofiltered data to new worksheet

    I thought Advanced Filter can only copy to the same sheet
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  9. #9
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Transfering large amounts of autofiltered data to new worksheet

    Roy

    You can do it both manually and with code. I'm sure you know about the code approach, but I found the manual one on a site somewhere, and thought it was pretty good. You have to be on the destination sheet to initiate proceedings, but it will work.

    Have a look at the attached. If you follow the steps I've detailed above but use sheet2 rather than sheet1, and criteria range H1:H2 (I've edited the post to correct), the data will be filtered from sheet1 to sheet2.

    rylo
    Attached Files Attached Files

  10. #10
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Transfering large amounts of autofiltered data to new worksheet

    Thanks for sharing Rylo, the manual method certainly seems to work.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1