+ Reply to Thread
Results 1 to 8 of 8

Code that extracts cell contents from specific cells

  1. #1
    Forum Contributor
    Join Date
    02-13-2016
    Location
    BMass
    MS-Off Ver
    2010
    Posts
    154

    Code that extracts cell contents from specific cells

    Hi, I have 8 Workbooks with about 20 Worksheets each and need a code that list the name of each Worksheet in a Workbook (some are hidden), then list the contents of a specific cell that is part of the worksheet name, then list the contents of a several cells in each worksheet that are exactly the same on a new worksheet within the file or creates a new Workbook that pulls from each of the 8 Workbooks and lists them in that workbook. I would want the finished product to look like attachment...

    Thank you.
    Attached Files Attached Files

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Code that extracts cell contents from specific cells

    Let me state the requirements in my own words to see if I understand it. You want to go through a directory and open up workbooks in the directory. Do you want all the workbooks or workbooks that match a certain name?

    Then you want to list all the sheets in the workbook. Are there any sheets you don't want to look at?

    Then you want the contents of cell D6 and the other 39 cells listed, presumably in the format you outlined on the sample workbook.

    Is this correct?
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Forum Contributor
    Join Date
    02-13-2016
    Location
    BMass
    MS-Off Ver
    2010
    Posts
    154

    Re: Code that extracts cell contents from specific cells

    Quote Originally Posted by dflak View Post
    Let me state the requirements in my own words to see if I understand it. You want to go through a directory and open up workbooks in the directory. Do you want all the workbooks or workbooks that match a certain name?

    Then you want to list all the sheets in the workbook. Are there any sheets you don't want to look at?

    Then you want the contents of cell D6 and the other 39 cells listed, presumably in the format you outlined on the sample workbook.

    Is this correct?
    Hi Dflak, The first part is correct. However I have no issues working within each workbook (since there are only eight) and keeping the information from each workbook on a new sheet within the existing workbook. The workbooks have different names.

    I don't need a separate list of the worksheets rather than I would want the name of each worksheet listed before the data, so you know which sheet the data belongs to since it’s the same group on every worksheet.
    For example in the workbook, there are worksheets named Apples, Oranges, Bananas, Peaches, Grapes, Mango, Papaya, Each one of these sheets have a couple hundred lines of data. I want a "snapshot" or "summary" sheet that gives the highlights or the pieces of info we need the most for an audience that can't go through all of the data.
    I don’t need every worksheet in the workbook...so it would be a range like 'Apples:Papayas' However in the current workbook I’m in that I need this for, it would be 55 out of 60 worksheets (basically everything minus control and input tabs etc)
    So once the data is pulled from each worksheet, I would need the worksheet name, plus a name box on the sheet so you know where the numbers belong-
    (The attached file is updated so it gives more detail. The Summary All worksheet accurately summarizes what’s needed as the outcome.)

  4. #4
    Forum Contributor
    Join Date
    02-13-2016
    Location
    BMass
    MS-Off Ver
    2010
    Posts
    154

    Re: Code that extracts cell contents from specific cells

    Should be on previous post
    Attached Files Attached Files

  5. #5
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Code that extracts cell contents from specific cells

    You mention that you don't need every worksheet in the workbook. How can I determine what sheets to select? Are there specific sheets to exclude?

  6. #6
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Code that extracts cell contents from specific cells

    Here's a first shot. I've set it up so that the files you are looking at are in a subdirectory. You specify what directory on the parameters page.
    Attached Files Attached Files

  7. #7
    Forum Contributor
    Join Date
    02-13-2016
    Location
    BMass
    MS-Off Ver
    2010
    Posts
    154

    Re: Code that extracts cell contents from specific cells

    Hi, Thank you. This works perfectly on the file you sent but when I tried to change it, I get run time errors.
    errors. I think its ok if this runs off of all worksheets within the workbook and all workbooks in the directory specified. Do you have to add the names of the workbooks to the code?
    Attached Files Attached Files

  8. #8
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Code that extracts cell contents from specific cells

    One thing I can see is that you "clobbered" the table in cells A5:A18. Keep the parameters page separate. I chose to read the data from a sheet rather than to "hard code" it into the code itself. This makes the program a bit more flexible. All you need to do is update this table if your target sheets change.

    The template page is optional. I kept it in so I had something to model after. You can keep it or delete it.

    The way the code is set up, it will delete all pages except those named Template or Parameters before running the rest of the code.

    After making these adjustments, if you still have an error, select the debugger and tell me what line of code is highlighted. See if you can get a screen capture in JPG format (I can't read PNG).

+ 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. simple code that extracts several items from middle of cell
    By l_eonandr in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-12-2016, 05:02 PM
  2. [SOLVED] Code that extracts specific sheet in multiple workbooks to one workbook
    By KT999 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 12-04-2014, 10:05 AM
  3. [SOLVED] Clear contents of specific cells on the same row if a specific cell on that row is empty
    By djfscouse in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-28-2014, 01:48 PM
  4. Code to clear contents of a cell based on specific criteria
    By srsev in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-21-2013, 01:38 PM
  5. Returning the contents of a specific cell using a MATCH of 2 other cells
    By oneblondebrow in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 04-08-2013, 08:41 AM
  6. Code to clear contents of specific cells based upon if key exists in other sheets
    By seputus in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-31-2013, 07:25 PM
  7. VBA Code to amend specific sheet based on cell contents.
    By AndrewMac in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-09-2012, 06:03 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