+ Reply to Thread
Results 1 to 4 of 4

Filter range, copy range (not entire column), paste in another worksheet

  1. #1
    Registered User
    Join Date
    05-08-2018
    Location
    Netherlands
    MS-Off Ver
    MS 2013
    Posts
    15

    Filter range, copy range (not entire column), paste in another worksheet

    Hi,

    I want to filter range F14:I58, based on I having a value. Then copy the filtered selection and paste it at the bottom of another worksheet.
    Using the below code I would get an error (I59 also contains a value in merged cells. I don't want anything below 58 to be copied) - so I would get the error 'Cannot do that to part of a merged cell' as it tried to copy I59 with the offset rule.
    I solved this by adding a blank, hidden row between I58 and I59, which worked for a few days.
    Now if I13:I58 is all blank, it will filter to nothing, but then copy the entire F13:I58 and paste it all, ignoring the filter.
    Any help?
    Please Login or Register  to view this content.

  2. #2
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Filter range, copy range (not entire column), paste in another worksheet

    It is not ignoring the filter, it is doing what the code tells it to do. You are filtering for blank cells by using the "<>" criteria. So the filtered data will show all rows with a blank value in column I for the specified range. If you want to filter for cells with values, then change your criteria to ">".
    Any code provided by me should be tested on a copy or a mock up of your original data before applying it to the original. Some events in VBA cannot be reversed with the undo facility in Excel. If your original post is satisfied, please mark the thread as "Solved". To upload a file, see the banner at top of this page.
    Just when I think I am smart, I learn something new!

  3. #3
    Registered User
    Join Date
    05-08-2018
    Location
    Netherlands
    MS-Off Ver
    MS 2013
    Posts
    15

    Re: Filter range, copy range (not entire column), paste in another worksheet

    I don't understand your answer sorry -

    Column I contains date values.
    The criteria/ filter is working perfectly - If I step through the code, any time I has a date, those rows remain.
    If there are no dates in I - the entire table disappears as it should.
    If I contains dates, the code does what it should and only copies those rows with a date to the new sheet.
    The only problem is when the whole column I is blank - then the table is filtered to nothing, but the copy still selects all of the hidden cells, instead of copying nothing like it should

  4. #4
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Filter range, copy range (not entire column), paste in another worksheet

    Yep, my error. Reading it wrong. Maybe using specialcells would work.

    Please Login or Register  to view this content.
    Untested

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Filter range and copy selected column visible data and paste other sheet
    By HaroonSid in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-19-2017, 11:37 AM
  2. If cells match from one worksheet to another, copy / paste entire column.
    By iracknback in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 12-05-2016, 11:19 AM
  3. Search for specific date range, copy entire row and paste to new worksheet
    By turias in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-04-2013, 03:57 PM
  4. [SOLVED] Copy/Paste Range to the bottom of a range on another worksheet using VBA
    By tsamuels in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-18-2013, 10:11 PM
  5. vba to copy an entire row or a range and paste values to next available row
    By bouncer84 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-22-2012, 04:56 AM
  6. Copy a range and paste it into another worksheet range
    By JimmySmith in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-24-2012, 01:30 PM
  7. Copy range from worksheet based on data in a column and paste to end of another ws
    By DavyNixon in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-18-2005, 01:29 PM

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