+ Reply to Thread
Results 1 to 6 of 6

Grab specific rows from all worksheets and place into single column

  1. #1
    Registered User
    Join Date
    04-23-2007
    Posts
    34

    Grab specific rows from all worksheets and place into single column

    Hello all, I have a bit of a strange request.

    I have 50 worksheets in my Excel File.

    I am wondering if it's possible to create a new worksheet, and then automatically grab rows 1-50 from each worksheet (column a), and place them in a single column.

    My new worksheet would then have 2,500 rows in column a (rows 1-50 from each worksheet).

    My worksheets have unique names and it would be quite time consuming to specify each one (in a formula for example) - so ideally I'd like to just move sequentially through worksheets until the end.

    I'd also like to repeat the process with rows 51-100 (on a new sheet) - so being able to specify the row numbers would be great.

    Thanks in advance for any suggestions.

  2. #2
    Forum Expert WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    2,182

    Re: Grab specific rows from all worksheets and place into single column

    Something like this will work but it doesn't have lots of error checking:

    Please Login or Register  to view this content.
    WBD
    Office 365 on Windows 11, looking for rep!

  3. #3
    Registered User
    Join Date
    04-23-2007
    Posts
    34

    Re: Grab specific rows from all worksheets and place into single column

    Thanks so much for the prompt reply. I'm getting Run-time error '1004': Application-defined or object-defined error.

    Do I need to hard-code any actual names into the function or should it just run on the new worksheet?

    Thanks

  4. #4
    Forum Expert WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    2,182

    Re: Grab specific rows from all worksheets and place into single column

    Oops. A rogue colon crept in there.

    Please Login or Register  to view this content.
    Should just work (hopefully) now.

    WBD

  5. #5
    Registered User
    Join Date
    04-23-2007
    Posts
    34

    Re: Grab specific rows from all worksheets and place into single column

    Hi there, this is working great thank you.

    Just one thing. On the new worksheet - it starts the collection from Row 51 - rather than from Row 1 - not a big deal I can just scroll down to grab them.

    Also - if I wanted to change the Row Selection for each worksheet - can I just adjust the values in the alert that pops up - or should I adjust the code manually, eg:

    Please Login or Register  to view this content.

  6. #6
    Forum Expert WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    2,182

    Re: Grab specific rows from all worksheets and place into single column

    OK. Some notes:

    Please Login or Register  to view this content.
    These lines get the first/last rows to copy to the new worksheet. It's done by splitting the input at "-" and taking the number each side. If you enter "2-18" in the box, it will take rows 2 to 18 from each source worksheet.

    Please Login or Register  to view this content.
    This sets the first row on the new worksheet that is added so the data from the first worksheet in your workbook will be copied to A1 on the new worksheet.

    Please Login or Register  to view this content.
    This processes the first 50 worksheets in your workbook. If your first sheet is at number 2 then you could change the 1 and 50 to be, for example, 2 and 51.

    If you want to change the row selection for each worksheet, you have two options:

    1. Take all the available rows from each worksheet - this can be done by fetching the last populated row in column A and is a small code change.
    2. Have configurable ranges for each worksheet - this is more complex and would require specifying 50 different row ranges (one for each source worksheet).

    WBD

+ 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: 1
    Last Post: 01-29-2020, 05:19 PM
  2. Replies: 4
    Last Post: 05-13-2016, 07:26 PM
  3. Replies: 1
    Last Post: 03-20-2015, 08:47 PM
  4. grab data from specific column of current row (Application.Caller)
    By Armitage2k in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-25-2015, 05:51 AM
  5. [SOLVED] Place worksheets in a specific order (Excel 2010)
    By TheRobsterUK in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-28-2014, 08:42 AM
  6. [SOLVED] Grab the number of x in column a if found in column b under a specific name
    By HNoel33 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-03-2013, 01:56 PM
  7. Macro for linking cells from different rows to a specific place on other worksheets
    By rdetreville in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-27-2011, 04:33 PM

Tags for this Thread

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