+ Reply to Thread
Results 1 to 16 of 16

Search multiple columns from Multiple Worksheets and copy rows into a Summary Worksheet

  1. #1
    Registered User
    Join Date
    09-01-2017
    Location
    Illinois
    MS-Off Ver
    Microsoft 2016
    Posts
    7

    Search multiple columns from Multiple Worksheets and copy rows into a Summary Worksheet

    I am new to Macros or you could say very very rusty. I am trying to compile production for certain items over multiple weeks over multiple worksheets. I need the Macro to search columns F, J, N, R & V in all worksheets for a certain Item and then copy that info in that row into a Summary Worksheet.
    The info I specifically need copied would be in the row the item was found-Column A, B & C every time and then if found in column F-need DEFG, if J-need HIJK, if N-need LMNO, if R-need PQRS, if V-TUVW.
    I have attached an example of the database. I would like to be able to search by "Blue Moon" or any other item listed in the columns F, J, N, R & V.
    Attached Files Attached Files

  2. #2
    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,872

    Re: Search multiple columns from Multiple Worksheets and copy rows into a Summary Workshee

    Give this a try:

    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

  3. #3
    Registered User
    Join Date
    09-01-2017
    Location
    Illinois
    MS-Off Ver
    Microsoft 2016
    Posts
    7

    Question Re: Search multiple columns from Multiple Worksheets and copy rows into a Summary Workshee

    Alan, thanks that is getting most of what I need. I do need to also copy at least column B in the same row that the item was found. Preferably I would like columns A:C in that row.
    ws.Range(Cells(i, *Column A:C?*), Cells(i, j - 2), Cells(i, j + 1)).Copy

  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,872

    Re: Search multiple columns from Multiple Worksheets and copy rows into a Summary Workshee

    I would do it in two steps

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    09-01-2017
    Location
    Illinois
    MS-Off Ver
    Microsoft 2016
    Posts
    7

    Re: Search multiple columns from Multiple Worksheets and copy rows into a Summary Workshee

    It doesn't like this line:
    ws.Range(Cells(i, 1), Cells(i, 3)).Copy

  6. #6
    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,872

    Re: Search multiple columns from Multiple Worksheets and copy rows into a Summary Workshee

    Ok. Change that to
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    09-01-2017
    Location
    Illinois
    MS-Off Ver
    Microsoft 2016
    Posts
    7

    Re: Search multiple columns from Multiple Worksheets and copy rows into a Summary Workshee

    So that worked at getting columns a-c copied over, but then I got a Method error for this line "ws.Range(Cells(i, j - 2), Cells(i, j + 1)).Copy" which had worked before.
    Thank you for helping so far!

  8. #8
    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,872

    Re: Search multiple columns from Multiple Worksheets and copy rows into a Summary Workshee

    What does the error message say exactly.

  9. #9
    Registered User
    Join Date
    09-01-2017
    Location
    Illinois
    MS-Off Ver
    Microsoft 2016
    Posts
    7

    Re: Search multiple columns from Multiple Worksheets and copy rows into a Summary Workshee

    Run time error '1004'
    Method 'Range' of object '_worksheet' failed

  10. #10
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,607

    Re: Search multiple columns from Multiple Worksheets and copy rows into a Summary Workshee

    ws.replace: Range(Cells(i, j - 2), Cells(i, j + 1)).Copy, with:
    Please Login or Register  to view this content.
    Ben Van Johnson

  11. #11
    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,872

    Re: Search multiple columns from Multiple Worksheets and copy rows into a Summary Workshee

    Try this amended code:
    Please Login or Register  to view this content.

  12. #12
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Search multiple columns from Multiple Worksheets and copy rows into a Summary Workshee

    Change the code to
    Please Login or Register  to view this content.
    and there will be no need to activate the sheet.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  13. #13
    Registered User
    Join Date
    09-01-2017
    Location
    Illinois
    MS-Off Ver
    Microsoft 2016
    Posts
    7

    Re: Search multiple columns from Multiple Worksheets and copy rows into a Summary Workshee

    THANK YOU - THIS WORKS GREAT!!!

    I have 1 more question - can I grab cell A1 in each copy? A1 contains the Date of each sheet.

  14. #14
    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,872

    Re: Search multiple columns from Multiple Worksheets and copy rows into a Summary Workshee

    try this amended code

    Please Login or Register  to view this content.

  15. #15
    Registered User
    Join Date
    09-01-2017
    Location
    Illinois
    MS-Off Ver
    Microsoft 2016
    Posts
    7

    Re: Search multiple columns from Multiple Worksheets and copy rows into a Summary Workshee

    Thank You Thank You Thank YOU!!! It works!!

  16. #16
    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,872

    Re: Search multiple columns from Multiple Worksheets and copy rows into a Summary Workshee

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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. Is it possible to copy rows from multiple worksheets into one summary page?
    By sheppharde in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-25-2014, 01:31 AM
  2. [SOLVED] Copy only range of columns from multiple worksheets to a summary worsheet
    By fakafan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-14-2014, 06:55 PM
  3. [SOLVED] Problem with macro to copy certain data from multiple worksheets into a summary worksheet
    By niftysquirrel in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-14-2013, 03:35 PM
  4. [SOLVED] Copy multiple worksheets data & paste into blank columns in summary worksheet
    By guest99999 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-21-2013, 09:56 AM
  5. [SOLVED] Maco 2 Copy dynamic data from multiple worksheets into Summary worksheet in same workbook
    By abrennan in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 09-16-2012, 03:40 AM
  6. Search multiple worksheets and copy cells to summary sheet
    By crttrlvr in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-09-2012, 03:01 PM
  7. Macro to copy rows from multiple worksheets to summary sheet
    By zmbd in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-10-2011, 10:21 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