+ Reply to Thread
Results 1 to 10 of 10

Moving Rows from Workbook 1 to Workbook 2 if Column H has "X" value

  1. #1
    Registered User
    Join Date
    11-28-2016
    Location
    Chicagoland
    MS-Off Ver
    2016
    Posts
    7

    Moving Rows from Workbook 1 to Workbook 2 if Column H has "X" value

    Excel 2016

    I'd like to make a list in Workbook 2 from data in Workbook 1, and be able to sort that list.

    For all rows in Workbook 1, if the cell in Column H has an "X" in it, I'd like to copy Column A-K of that Row to Rows sorted First by Column C (Descending) and then Column E (Descending) in Workbook 2.

    I've pretty basic knowledge of Excel and am not sure if this is done with If/Then statements, or a Macro.



    Workbook 1 is named 'Master Maintenance.xlsx'

    Workbook 2 is named '2017 Lawn Maintenance List.xlsx'
    Last edited by Spirographed; 11-29-2016 at 10:07 AM.

  2. #2
    Forum Contributor
    Join Date
    03-14-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    491

    Re: Moving Rows from Workbook 1 to Workbook 2 if Column H has "X" value

    Can you attach a sample workbook with data please?

  3. #3
    Registered User
    Join Date
    11-28-2016
    Location
    Chicagoland
    MS-Off Ver
    2016
    Posts
    7

    Re: Moving Rows from Workbook 1 to Workbook 2 if Column H has "X" value

    No problem.
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    05-20-2015
    Location
    Chicago, Illinois
    MS-Off Ver
    2016
    Posts
    2,103

    Re: Moving Rows from Workbook 1 to Workbook 2 if Column H has "X" value

    The walkthrough (steps 1-11) in this link should do the trick:

    http://www.ashishmathur.com/dynamica...et-to-another/

    Note that the "X" is case sensitive, so enter a capital X in step 8. You'll also get a chance to sort by your two columns prior to step 9. If done correctly, you'll just need to hit "refresh" on your filtered sheet to update the filtered sheet once you've made changes to your main data table. The walkthrough is not my own work, but I gave it a test run with your data and it seemed to function as requested.

    EDIT: It's also worth noting that the instructions are for a sheet to sheet relationship, but it works just as well with two different workbooks.
    Last edited by CAntosh; 11-28-2016 at 02:25 PM.

  5. #5
    Forum Contributor
    Join Date
    10-19-2012
    Location
    Omaha, Nebraska USA
    MS-Off Ver
    Excel 2010
    Posts
    249

    Re: Moving Rows from Workbook 1 to Workbook 2 if Column H has "X" value

    Hi Spirographed,

    Here is a workbook that if it is put in the same folder with the two files you are coordinating has code to do what you are describing. The code fires when the attached workbook is opened and will prompt you if you want to continue, so you can say "No" and then hit <ALT> F11 to view the code to give you some ideas or let it run to see how it works. It will only modify the 2017 Lawn Maintenance List.xlsx file, it leaves the other one unmodified.

    Hope that helps,

    Dan
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    11-28-2016
    Location
    Chicagoland
    MS-Off Ver
    2016
    Posts
    7

    Re: Moving Rows from Workbook 1 to Workbook 2 if Column H has "X" value

    Quote Originally Posted by cantosh View Post
    The walkthrough (steps 1-11) in this link should do the trick:

    http://www.ashishmathur.com/dynamica...et-to-another/

    Note that the "X" is case sensitive, so enter a capital X in step 8. You'll also get a chance to sort by your two columns prior to step 9. If done correctly, you'll just need to hit "refresh" on your filtered sheet to update the filtered sheet once you've made changes to your main data table. The walkthrough is not my own work, but I gave it a test run with your data and it seemed to function as requested.

    EDIT: It's also worth noting that the instructions are for a sheet to sheet relationship, but it works just as well with two different workbooks.
    Hmmm...When I get to the last step, and click Finish, it loads some info into the Query window behind the "Finish" window, but doesn't actually finish. I can just keep clicking "Finish" without it doing anything else.

  7. #7
    Registered User
    Join Date
    11-28-2016
    Location
    Chicagoland
    MS-Off Ver
    2016
    Posts
    7

    Re: Moving Rows from Workbook 1 to Workbook 2 if Column H has "X" value

    Thanks! I'm not sure it's for me though, because I will be doing this with multiple worksheets and columns, so I'll need something like the 1st suggestion where I can replicate it.

  8. #8
    Forum Expert
    Join Date
    05-20-2015
    Location
    Chicago, Illinois
    MS-Off Ver
    2016
    Posts
    2,103

    Re: Moving Rows from Workbook 1 to Workbook 2 if Column H has "X" value

    Quote Originally Posted by Spirographed View Post
    Hmmm...When I get to the last step, and click Finish, it loads some info into the Query window behind the "Finish" window, but doesn't actually finish. I can just keep clicking "Finish" without it doing anything else.
    Hmmm... I can't get my Excel to replicate your error. Maybe try the whole process again from scratch? Double check that the named range is =Sheet1!$A$1:$R$75 (in your sample). In the "Query Wizard - Filter Data" step, use the dropdowns to select "equals" and "X" to ensure that there aren't any syntax issues. Beyond that, I don't use queries often enough to diagnose what's causing the hiccup. Maybe someone else can weigh in?

  9. #9
    Registered User
    Join Date
    11-28-2016
    Location
    Chicagoland
    MS-Off Ver
    2016
    Posts
    7

    Re: Moving Rows from Workbook 1 to Workbook 2 if Column H has "X" value

    Redid the whole thing, and noticed a difference right away. For some reason it was making an empty table the first time. It works! Thank you so much for your help!

  10. #10
    Forum Expert
    Join Date
    05-20-2015
    Location
    Chicago, Illinois
    MS-Off Ver
    2016
    Posts
    2,103

    Re: Moving Rows from Workbook 1 to Workbook 2 if Column H has "X" value

    My pleasure, good luck!

+ 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. [SOLVED] Open Workbook in "Full Screen" mode but with sized "Window" View
    By HGL in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-19-2016, 05:54 AM
  2. Activating unsaved open workbook using "if "name" like "name" satement
    By joshuarobbins in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-22-2015, 11:17 AM
  3. Macro to copy cells from workbook,where column C is = "num1" AND Column D ="num2"
    By jarious87 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-10-2013, 03:30 PM
  4. Replies: 1
    Last Post: 05-23-2013, 02:04 PM
  5. [SOLVED] Update from "August" workbook to "year to Date"-workbook
    By esbenhaugaard in forum Excel Programming / VBA / Macros
    Replies: 31
    Last Post: 08-20-2012, 03:30 PM
  6. Replies: 6
    Last Post: 03-14-2012, 01:01 AM
  7. Populate "master" workbook through another "user" workbook
    By psychedelik36 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-14-2010, 03:35 PM

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