+ Reply to Thread
Results 1 to 10 of 10

Copy whole rows from another workbook if condition is met then filter those rows

  1. #1
    Registered User
    Join Date
    08-29-2018
    Location
    NRW, Germany
    MS-Off Ver
    2010
    Posts
    6

    Copy whole rows from another workbook if condition is met then filter those rows

    Hello dear Excel Forum community,

    this is my first time describing an Excel-Problem, so please don't be too harsh -I will try to give you every Information you Need to be able to help me. :D

    [disclaimer: The workbooks are attached to this post.]

    The situation I'm stuck (with my primitive "copy code and hope it works" method) at is the following:

    I work with 2 workbooks. One contains the data of People (e.g. adress, phone number, etc.). At the last colum (e.g. "J") is my condition, if I want to copy this specific (but the whole!) row: "yes" or "no".

    The data is copied to another workbook, which contains a Queue in which the People with the condition "yes" get sorted into.


    My current solution is kinda crappy - I know that. It works, but only if I (the one who wrote it) maintains it every few weeks and so on. I want it to work even with someone who doesn't know what it does.


    Here goes:

    At the Moment, I have in my workbook #1 my list of data with the condition yes or no (please see pic#1)

    I copy this list to my other workbook#2 with simple ref-links into sheet #2 (please see pic #2) (please note that in my Picture the data is "invalid" - because the valid data is already cut to sheet#1)

    In my workbook#2 there is a VBA-Code, which helps me filter the "yes" conditions from sheet#2 to my sheet #1(the Queue) (please see pic#3).

    My Problem: At the Moment, I Need to click into the "yes" condition in my workbook#2 in sheet #2, otherwise the VBA-Code won't cut the data to my sheet#1 (I have to activate the vba by having a makro at Startup click manually into the cells with the condition - please see pic#4 for this "click into cell" code).

    This - I could live with (even if it's a shitty solution). BUT: The cells which I Need to have checked every Startup will get more and more - the more People come into my data-file. At the Moment I only check cell 1-100, which takes about 10 seconds at start-up. But I would have to update the range in which to check every few weeks, so I won't have to wait 5 minutes for the file to check Range K1-1000.

    The Problem: I get the data from workbook#1 to workbook#2 by ref-links - which are cut by my vba. And I am Kind of lost - I can't imagine a solution, which fixes my Problem "in the Long run".

    I would be grateful for any ideas. I do hope someone actually has the Patience to read through this mess of mine.

    Thanks and best wishes, VBA_Casualnewbie.
    Attached Files Attached Files
    Last edited by VBA_Casualnewbie; 08-29-2018 at 01:28 PM.

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,518

    Re: Copy whole rows from another workbook if condition is met then filter those rows

    If upload those WORKBOOKS with before/after, it will help.
    Pictures doesn't help at all...

  3. #3
    Registered User
    Join Date
    08-29-2018
    Location
    NRW, Germany
    MS-Off Ver
    2010
    Posts
    6

    Re: Copy whole rows from another workbook if condition is met then filter those rows

    Quote Originally Posted by jindon View Post
    If upload those WORKBOOKS with before/after, it will help.
    Pictures doesn't help at all...
    oh - of course. Sorry, didn't think of this (don't know why actually). I will upload the workbooks in a few minutes, Need to clear them of critical data beforehand.

    thanks!

  4. #4
    Registered User
    Join Date
    08-29-2018
    Location
    NRW, Germany
    MS-Off Ver
    2010
    Posts
    6

    Re: Copy whole rows from another workbook if condition is met then filter those rows

    Sorry - I can't upload the workbooks from here (Firewall). I'll upload them asap. Thanks for your Patience!

    I've uploaded them in the main post. Thanks!
    Last edited by VBA_Casualnewbie; 08-29-2018 at 01:28 PM.

  5. #5
    Registered User
    Join Date
    08-29-2018
    Location
    NRW, Germany
    MS-Off Ver
    2010
    Posts
    6

    Re: Copy whole rows from another workbook if condition is met then filter those rows

    The Problem is still on my priority-list. :D

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,518

    Re: Copy whole rows from another workbook if condition is met then filter those rows

    Do you just want to filter "yes" and output to "QUEUE" sheet and "no" to "SHEET2" from "ALTE_VG" sheet in #1 book?

  7. #7
    Registered User
    Join Date
    08-29-2018
    Location
    NRW, Germany
    MS-Off Ver
    2010
    Posts
    6

    Re: Copy whole rows from another workbook if condition is met then filter those rows

    Quote Originally Posted by jindon View Post
    Do you just want to filter "yes" and output to "QUEUE" sheet and "no" to "SHEET2" from "ALTE_VG" sheet in #1 book?
    If possible, the only Thing I really want is to filter the "yes" condition from book#1 to "QUEUE" sheet from book#2, but only with VBA and not with e.g. "=ALTE_VG[$A$2]" ref links.

    I don't know how though - so at the Moment I work with the solution shown in my two workbooks - I copy every entry from book#1 "ALTE_VG" to sheet2 in book#2 and then filter to "QUEUE" - but I would prefer a possible shortcut to that solution.

    the downside of my current solution is described above - the Need to "check" the condition cell every Startup and the Problem, that sheet2 will go down forever till it reaches row9999 e.g. and is not "updated" to the rows 1-50.

  8. #8
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,518

    Re: Copy whole rows from another workbook if condition is met then filter those rows

    Quote Originally Posted by VBA_Casualnewbie View Post
    If possible, the only Thing I really want is to filter the "yes" condition from book#1 to "QUEUE" sheet from book#2, but only with VBA
    Try
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    08-29-2018
    Location
    NRW, Germany
    MS-Off Ver
    2010
    Posts
    6

    Re: Copy whole rows from another workbook if condition is met then filter those rows

    Hey jindon,

    thanks for your Patience and help!

    I've run into a few questions after trying:

    where do I put the code? at the Moment I've put it into "this worksheet" in workbook#1.

    second: do I Need to replace the "Excelfiles,*.xls*" with the Name of the workbooks? if my workbooks are named e.g. "workbook1" and "workbook2", would the code be

    fn = Application.GetOpenFilename("workbook1.xlsm,workbook2.xlsm")

    or would it be

    fn = Application.GetOpenFilename("workbook1;workbook2,*.xlsm*")

    or something like that?

  10. #10
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,518

    Re: Copy whole rows from another workbook if condition is met then filter those rows

    When dialogue box appear, select workbook that have data(dataworkbook#1).
    Attached Files Attached Files

+ 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] Copy rows from Workbook 1 to Workbook2 if condition is met
    By Xsample in forum Excel Programming / VBA / Macros
    Replies: 24
    Last Post: 03-01-2018, 10:24 AM
  2. Macro copies rows based on condition, BUT rows copy in Wrong order. PLEASE HELP!
    By JAllard1990 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-16-2014, 04:33 PM
  3. Double filter (condition) to delete rows
    By greatalex36 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-24-2014, 07:35 AM
  4. To copy specific rows after passing a condition into another workbook.
    By aysrun in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-10-2013, 03:15 AM
  5. macro to copy rows to another sheet based on condition mentioned in another workbook
    By sona_tejas in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-07-2013, 06:23 AM
  6. copy rows to specific worksheets in another workbook based on a condition
    By AngelaM in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-22-2012, 12:36 PM
  7. Replies: 1
    Last Post: 07-12-2007, 04:17 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