+ Reply to Thread
Results 1 to 9 of 9

VBA to Copy data from multiple workbook to a master sheet

  1. #1
    Registered User
    Join Date
    04-03-2015
    Location
    Trivandrum
    MS-Off Ver
    2007
    Posts
    5

    VBA to Copy data from multiple workbook to a master sheet

    Hi,

    Does any one help me to get a vba code that meets the below mentioned requirements,

    I want to copy certain rows from different workbook to a master copy, but the criteria for the selection of row from the work books is based on the date entered on the left most cell of the rows . and all work books follow the uniform structure. It would be great if I could enter a date in the input box and then the macro copy the rows with that particular date in the left most column. Please find below the snapshot of the work book that needs to be copied.

    Please Login or Register  to view this content.
    I got a vba code that partially fills my requirement. But that requires manually editing of the range in the macro code. Seems a message box to enter either the the range or the date , and the macro runs based on the inputs will fulfill my requirement.

    Please Login or Register  to view this content.

    Thanking you in advance,

    Regards,

    Lijith
    Last edited by JBeaucaire; 07-11-2015 at 10:56 AM. Reason: Added missing CODE tags. Please read and follow the Forum Rules, link above in the menu bar. Thanks.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: VBA to Copy data from multiple workbook to a master sheet

    So when the macro runs, you're really wanting to pull a single row from each of the workbooks, the one that matches the given date?

    Does the pile of workbooks you're accessing ever change? Or is it a static set of workbooks? The reason I ask is because if it's always the same then you might be able to get the results you want with a simple set of lookup formulas referencing those closed workbooks. No VBA needed in that case.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    04-03-2015
    Location
    Trivandrum
    MS-Off Ver
    2007
    Posts
    5

    Re: VBA to Copy data from multiple workbook to a master sheet

    Thank you JBeaucaire for the quick response. But I have around 80+ work books and it changes monthly.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: VBA to Copy data from multiple workbook to a master sheet

    Ok, so we're going to run through 80 random workbooks in a folder, open each one and search for ONE row with a particular date? Or would it be multiple rows?

  5. #5
    Registered User
    Join Date
    04-03-2015
    Location
    Trivandrum
    MS-Off Ver
    2007
    Posts
    5

    Re: VBA to Copy data from multiple workbook to a master sheet

    Exactly, what you said is correct, We need to copy single raw from 80 different workbooks to a master sheet. I need to copy only single raw from each sheeet but it should fill my condition I provided through input box.( either it is with the date or with the range( A3:H3 on one day and A4:H4 on next day) etc. ).
    Last edited by Lijith; 07-12-2015 at 04:34 AM.

  6. #6
    Registered User
    Join Date
    04-03-2015
    Location
    Trivandrum
    MS-Off Ver
    2007
    Posts
    5

    Re: VBA to Copy data from multiple workbook to a master sheet

    It seems, if we could find an option to input the range manually in the below mentioned line of the code I attached would be helpful.

    wbD.Sheets("Sheet1").Range("A3:H3").Copy

  7. #7
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: VBA to Copy data from multiple workbook to a master sheet

    See if the following modification works for you.....

    The below code will prompt you to input a date in Input Box and then check the column A in Sheet1 of all the destination workbooks and if found, it copies the row to the Master workbook.

    Please Login or Register  to view this content.
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  8. #8
    Registered User
    Join Date
    04-03-2015
    Location
    Trivandrum
    MS-Off Ver
    2007
    Posts
    5

    Re: VBA to Copy data from multiple workbook to a master sheet

    Thank you very much sktneer

    This is exactly what I was looking for and works perfectly. Once again thank you for your help and support.

  9. #9
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: VBA to Copy data from multiple workbook to a master sheet

    You're welcome.

    If that takes care of your original question, please mark your thread as Solved by selecting Thread Tools (just above your first post) --> Mark thread as solved.

+ 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. Replies: 12
    Last Post: 07-29-2014, 01:06 PM
  2. Copy data from multiple workbooks to one master workbook
    By kevinvanberkel in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-15-2014, 12:26 PM
  3. [SOLVED] Consolidate Data from 1 Range on 1 Sheet in Multiple Workbooks to Master Workbook Sheet
    By Jennasis in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-10-2013, 06:11 AM
  4. Copy Data from multiple workbooks to a master Workbook
    By zeeez in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-04-2012, 01:45 PM
  5. [SOLVED] Search for heading in data sheet and copy range to corresponding sheet in master workbook
    By sans in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 07-07-2012, 10:02 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