+ Reply to Thread
Results 1 to 10 of 10

Export rows to new sheet based on conditions being met

  1. #1
    Registered User
    Join Date
    09-08-2014
    Location
    Cambridge, England
    MS-Off Ver
    2013
    Posts
    5

    Export rows to new sheet based on conditions being met

    Hi, I wonder if someone can help as my VBA knowledge is a little limited. I’m looking to transfer filtered data from one spreadsheet to another based on some cell values, but then leave the data that did not meet that criteria in the existing spreadsheet. As an example, consider the following data:
    Type Make Cost Area ID
    Car Toyota 3000 Oxford 46254
    Car Toyota 4000 Bristol
    Car Nissan 5000 Bath
    Car Ford 6000 Cambridge 58778
    Van Ford 7000 Oxford
    Van Nissan 8000 Bristol 456555
    Bike Vauxhall 9000 Bath 55485
    Car Ford 10000 Cambridge 5544

    If I wanted to export all rows that were both Car in column A and were not blank in column E, how would I do this with VBA code so rows 2,5,9 are exported and removed from the current worksheet and listed in a new worksheet? Any help you can give would be greatly appreciated.

  2. #2
    Forum Contributor
    Join Date
    06-18-2012
    Location
    Chennai, India
    MS-Off Ver
    Excel 2003, 2010
    Posts
    212

    Re: Export rows to new sheet based on conditions being met

    post a sample workbook

  3. #3
    Registered User
    Join Date
    09-08-2014
    Location
    Cambridge, England
    MS-Off Ver
    2013
    Posts
    5

    Re: Export rows to new sheet based on conditions being met

    Please see attached - thanks
    Attached Files Attached Files

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,897

    Re: Export rows to new sheet based on conditions being met

    Please Login or Register  to view this content.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  5. #5
    Registered User
    Join Date
    09-08-2014
    Location
    Cambridge, England
    MS-Off Ver
    2013
    Posts
    5

    Re: Export rows to new sheet based on conditions being met

    Thanks for that, very helpful. However, this still copies across rows that don't have an ID. I only want rows which have both car, and an ID entered. Is there a small tweak needed?

    Thanks.

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Export rows to new sheet based on conditions being met

    Try:

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    09-08-2014
    Location
    Cambridge, England
    MS-Off Ver
    2013
    Posts
    5

    Re: Export rows to new sheet based on conditions being met

    This has worked perfectly, thanks all.

  8. #8
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Export rows to new sheet based on conditions being met

    If you are satisfied with the solutions given don't forget too mark your thread as solved. See Forum Rule No. 9.

    9. Acknowledge the responses you receive, good or bad. If your problem is solved, please say so clearly, and mark your thread as Solved: Click Thread Tools above your first post, select "Mark your thread as Solved". Or click the Edit button on your first post in the thread, Click Go Advanced, select [SOLVED] from the Prefix dropdown, then click Save Changes. If more than two days have elapsed, the Dropdown option or Edit button will not appear -- ask a moderator to mark it.

  9. #9
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,897

    Re: Export rows to new sheet based on conditions being met

    Thanks John for tweaking the code.
    Alan

  10. #10
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Export rows to new sheet based on conditions being met

    Quote Originally Posted by alansidman View Post
    Thanks John for tweaking the code.
    Alan
    You're welcome Alan. Seems it worked for him.

+ 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. Export data from master sheet to seperate worksheets dependent on 1-2 conditions
    By Cupomaxwell in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-10-2013, 10:04 AM
  2. [SOLVED] Export Rows based on value in column. Delete Row in current doc.
    By basketcase in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 12-18-2012, 12:49 PM
  3. [SOLVED] Export sheet to txt deleting blank rows
    By CassioGodinho in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-01-2012, 10:13 AM
  4. Replies: 0
    Last Post: 07-21-2011, 05:13 PM
  5. Copy rows from one sheet to another based on 2 conditions
    By chrispulliam in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-23-2010, 01:38 AM

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