+ Reply to Thread
Results 1 to 5 of 5

Filtering, Copy and Paste

  1. #1
    Registered User
    Join Date
    05-09-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    3

    Filtering, Copy and Paste

    Hi,

    I have this problem I have been working on and I can't seem to figure out why it doesn't work properly.

    This is what I am doing using VBA code:

    1. auto filter a "data sheet" with about 5000 records
    2. after filtering i am coping one column from the "data sheet"
    3. pasting the copied data into "new sheet"

    The problem is that I am not getting all the records. If I filter the "data sheet" manually I get 728 records (after the filtering) but when I use the code after the copy and paste is done I get only 693 records in the "new sheet".

    Does anyone know why?

    I can include the code if that will be needed.

    Many Thanks,
    Shay

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,524

    Re: Filtering, Copy and Paste

    What code are you referring to?

    My assumption is that the range is hard coded.

  3. #3
    Registered User
    Join Date
    05-09-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Filtering, Copy and Paste

    Hi Davesexcel,

    Thanks for the quick reply.

    You are correct. The range is hard coded. Is there a different way that I should be doing this?

    Here is part of the code:

    Please Login or Register  to view this content.
    Thanks,
    Shay
    Last edited by davesexcel; 05-09-2012 at 08:24 PM. Reason: Code tags required when showing VBA code, please read the forum rules

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,524

    Re: Filtering, Copy and Paste

    If you have 5000 rows then you should be copying 5000 rows not 500, the code will only copy the visible cells anyway.
    You destination range should just be A1, not A1:A500

    More clarification can be achieved if you attach a sample workbook.

  5. #5
    Registered User
    Join Date
    05-09-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Filtering, Copy and Paste

    Thanks!! That worked. I just used "A1" in the destination range and got the data I was expecting.

    Thanks again,
    Shay

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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