+ Reply to Thread
Results 1 to 15 of 15

Pull certain cells from muliple sheets

  1. #1
    Registered User
    Join Date
    12-26-2015
    Location
    New Jersy
    MS-Off Ver
    2007
    Posts
    10

    Pull certain cells from muliple sheets

    Hi, new to this forum and hoping someone can clear this up for me.

    I have a workbook with several hundred sheets. I want to pull data from the same 18 cells (not grouped together, ie; C19, G10, G29..etc) but in this way if possible.
    All sheets C19 are to go into column A, G10 would go into column B and so on.
    Also I want sheets with blanks in those cells must be skipped leaving no blanks in the master list.

    I have some code from MS that will list the data in Column A but it leaves blanks and column B starts where the end of Column A finishes.
    I know this is a lot, but any help would be great!
    Thanks

  2. #2
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Pull certain cells from muliple sheets

    Probably have to use an array to list your 18 cell addresses, then loop a query to see if they are blank while adding your non blank cells to a variable using the Union method. Example.

    Please Login or Register  to view this content.
    This is untested so it might have a glitch. Also note the periods in front of the Range in the array statement. They are needed to make the 'With sh' Statement work. Also, the Union method will paste whatever ends up in the variable as contiguous cells horizontally from the anchor cell, no matter which worksheet cell the first range is formed from. ie. If the first cell of the Union came from G29, it would still be posted to column A with the remaining Uion cells immediately to its right.
    Last edited by JLGWhiz; 12-28-2015 at 05:45 PM.

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: Pull certain cells from muliple sheets

    Hi, welcome to the forum

    Quote Originally Posted by dmkolb View Post
    I have a workbook with several hundred sheets.
    wow that is probably several hundred sheets too many, why on earth do you need to many?
    how do you find anything?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Registered User
    Join Date
    12-26-2015
    Location
    New Jersy
    MS-Off Ver
    2007
    Posts
    10

    Re: Pull certain cells from muliple sheets

    FDibbins, it's my family tree! Each sheet goes out 4 generations an then each of the 8 on the right go to another sheet and so on! lol
    JLGwhiz I will try your idea when I get a chance, thanks.

  5. #5
    Registered User
    Join Date
    12-26-2015
    Location
    New Jersy
    MS-Off Ver
    2007
    Posts
    10

    Re: Pull certain cells from muliple sheets

    I get an error here:
    rAry = Array(.range("C19"), .range("G10"))
    it highlights the word .range

    but thanks so far!
    Last edited by dmkolb; 12-28-2015 at 06:35 PM. Reason: Highlight text didn't work

  6. #6
    Registered User
    Join Date
    12-26-2015
    Location
    New Jersy
    MS-Off Ver
    2007
    Posts
    10

    Re: Pull certain cells from muliple sheets

    I found if I take the . out of in front of range, it works.
    Now errors at set rng = Union part
    I added Application.Union but it wants and argument, argh

  7. #7
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Pull certain cells from muliple sheets

    Quote Originally Posted by dmkolb View Post
    I get an error here:
    rAry = Array(.range("C19"), .range("G10"))
    it highlights the word .range

    but thanks so far!
    You might have to move that array statement to inside the 'With sh' statement and leave the periods in front of the Range. Like I said, I didn't test it, just trying to give you an idea of how to do it. I have used similar before, but it has been a while.

  8. #8
    Registered User
    Join Date
    12-26-2015
    Location
    New Jersy
    MS-Off Ver
    2007
    Posts
    10

    Re: Pull certain cells from muliple sheets

    OK here is the code as I have it now, but when the search hits a blank it stops at rng.copy

    Please Login or Register  to view this content.

  9. #9
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Pull certain cells from muliple sheets

    The Union can be difficult at times when copying. Let's try a different approach. Might take a little longer to run, but should give better results.
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    12-26-2015
    Location
    New Jersy
    MS-Off Ver
    2007
    Posts
    10

    Re: Pull certain cells from muliple sheets

    Seems to work but leaves blanks in column B, but I can work with this. Now I have to add several more cells to the array and it already took 5 minutes for 2 columns, phw. But thanks for all your help

  11. #11
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Pull certain cells from muliple sheets

    Quote Originally Posted by dmkolb View Post
    Seems to work but leaves blanks in column B, but I can work with this. Now I have to add several more cells to the array and it already took 5 minutes for 2 columns, phw. But thanks for all your help
    I have had company for the past few days. They are gone now, so if I get time I will try to get a speedier code for you.
    Regards, JLG

  12. #12
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Pull certain cells from muliple sheets

    this might be a little faster, but not much. With all those sheets, I don't think you will get a really speedy macro.
    Please Login or Register  to view this content.
    Don't forget to put your actual range references into the Union function.
    Last edited by JLGWhiz; 12-30-2015 at 03:20 PM.

  13. #13
    Registered User
    Join Date
    12-26-2015
    Location
    New Jersy
    MS-Off Ver
    2007
    Posts
    10

    Re: Pull certain cells from muliple sheets

    Thanks, I'll try this when I can. Just a thought what if we make each range a separate Module? This way I could run them only if that cell changes?

  14. #14
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Pull certain cells from muliple sheets

    I don't really understand what your overall objective is, so I couldn't say whether it is a good idea or not. The macro I suggested is looking at all the sheets and copying from all, or most of them. So this statement
    This way I could run them only if that cell changes?
    is a little confusing.

  15. #15
    Registered User
    Join Date
    12-26-2015
    Location
    New Jersy
    MS-Off Ver
    2007
    Posts
    10

    Re: Pull certain cells from muliple sheets

    Sorry I should have said as I add new sheets, as this Family tree isn't complete yet. I'm adding several new sheets a day.
    But I will go with what you offered for now, I may revisit this idea later, when I have it completed.
    Thanks again!

+ 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] VLOOKUP over the whole workbook (muliple sheets)
    By Exodus_NZ in forum Excel Formulas & Functions
    Replies: 58
    Last Post: 09-18-2013, 03:43 PM
  2. Replies: 3
    Last Post: 04-13-2012, 06:18 PM
  3. text from muliple sheets
    By Pegaasus in forum Excel General
    Replies: 5
    Last Post: 03-13-2011, 02:53 AM
  4. Workbook with muliple sheets
    By rvdsabu4life in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-14-2008, 05:45 PM
  5. [SOLVED] Standardizing Page Set Up for Muliple Sheets
    By JOUIOUI in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-21-2006, 07:10 AM
  6. Lookups over muliple sheets
    By don in forum Excel General
    Replies: 1
    Last Post: 06-04-2006, 03:45 AM
  7. Create muliple sheets using querytable
    By mdengler in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-27-2006, 03:45 PM
  8. Pull Cells From Sheets
    By Optitron in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-15-2005, 09:05 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