+ Reply to Thread
Results 1 to 6 of 6

Combine data from different sheets in Book1 into new sheet in Book2 whne run macro

  1. #1
    Registered User
    Join Date
    03-29-2017
    Location
    Fiji
    MS-Off Ver
    2019
    Posts
    12

    Combine data from different sheets in Book1 into new sheet in Book2 whne run macro

    I have data in a few tabs in Book1 and when I run macro (button locate in Book2) I want to combine everything into new sheet in Book2. However, it isn't just copy and paste.
    In my book1 I have COL A:F that contain same info that use for G:P some COL are blank.
    When combine data I want A:F to repeat (add more rows) for when G:P isn't empty.

    I have attached Book1 which the data and Book2 how I wanted it to look like after run macro. Is there a way to do this? I actually have more than 2 sheet to combine but the attached example should be good for the example.

    Thank you in advance!
    Attached Files Attached Files

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Combine data from different sheets in Book1 into new sheet in Book2 whne run macro

    Hi,

    The approach I'd take is to create a macro in Book 1 to be run on each sheet which would
    1. For each row on the sheet count the number of values in G:I
    2. Copy cells A:F and paste to as many new rows as the count indicates on a new summary sheet at the next blank row
    3. For each new row add the G/H/I/J value (if not blank) to column G in the summary
    4. For each new row add the K/L/M/N value (if not blank) to column H in the summary
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    03-29-2017
    Location
    Fiji
    MS-Off Ver
    2019
    Posts
    12

    Re: Combine data from different sheets in Book1 into new sheet in Book2 whne run macro

    Hi Richard, thank you for your suggestion. My actual book1 is locate in share drive but I don't anybody to acess the file so I keep my book2 in local drive. Is there a way to do macro in book2?

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Combine data from different sheets in Book1 into new sheet in Book2 whne run macro

    Quote Originally Posted by MayDay1988 View Post
    Hi Richard, thank you for your suggestion. My actual book1 is locate in share drive but I don't anybody to acess the file so I keep my book2 in local drive. Is there a way to do macro in book2?
    If you don't wan't anyone to access the file why not password protect the workbook so that it can't be opened?

  5. #5
    Registered User
    Join Date
    03-29-2017
    Location
    Fiji
    MS-Off Ver
    2019
    Posts
    12
    It is more secured to keep ut away from share drive, nobody can delete the file and etc.

  6. #6
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Combine data from different sheets in Book1 into new sheet in Book2 whne run macro

    So you're saying that even you aren't allowed to access the shared drive?

    Why not then simply have your local workbook 2 run a macro that opens the file in book 1 which contains the macro I suggested and then run that macro?

    As an aside it seems somewhat ironical that you have a shared drive that can't be 'shared' for this purpose.

    However, and since you need some sort of external macro to access the file to do what you want to do, there seems nothing to prevent someone else simply writing a macro to delete any file in that shared folder.

+ 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. Import particular data from book1 to book2 and format the order
    By Josekmathew in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-10-2016, 08:41 PM
  2. Replies: 3
    Last Post: 05-02-2016, 12:06 PM
  3. Remove row from Book1 and paste it in Book2
    By Tona in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-26-2016, 05:00 AM
  4. [SOLVED] Using a formulas from Book1 To Book2
    By Eric_Raine_85 in forum Excel General
    Replies: 3
    Last Post: 04-13-2016, 11:16 PM
  5. compare products from Book1 to Book2 and show differences
    By garyk76 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-09-2010, 06:31 AM
  6. subtract values of book1 from book2
    By adyan76 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-26-2009, 06:12 AM
  7. Replies: 1
    Last Post: 11-08-2005, 08:40 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