+ Reply to Thread
Results 1 to 13 of 13

copy common cells and variable range from multiple worksheets to single master workbook

  1. #1
    Registered User
    Join Date
    08-07-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2003
    Posts
    12

    copy common cells and variable range from multiple worksheets to single master workbook

    Hoping that someone can help me!

    I'm a complete novice when it comes to VBA, but i have an urgent need for help with a particular project at work.

    Basically, i have a common workbook template that is used by multiple users across the business to request a cost for numerous new products.

    Within the template, there is a common section at the top, where specific project information is entered. There is also a table beneath where 1 or many products can be entered, with specific information relating to that product in the same row.

    All the submitted requests are uploaded via an email attachment, to a particular sharepoint directory.

    What i would like to do in the master workbook is the following:-

    1. Open in turn every uploaded workbook within the sharepoint directory and copy the following cells into the master workbook, each in it's own row (or next available), with the data in adjacent cells.... 1st cell to enter data is $B6.

    Cells to copy from each sheet:

    Common info contained within cells:
    $DG$2,$N$11,$N$12,$N$19,$N$13,$AO$7,$AO$8,$AO$9,$AO$10,$AO$11,$AO$12,$AO$12,$AO$13,$AO$14,$BO$8,$BO$11,$BO$14

    Product specific info: $U37, $AD37, $AH37, $DH37, $C37, $O37
    Depending on the number of products requested, we need to repeat (loop?) until it finds the next blank row in the table. I have hidden a blank row in the table, so there will always be one!
    All of the common information needs to be included for each product specific entry.

    For each file, once the upload has been completed, i would like the file to be moved to another "archive" directory.

    I have attached the template for information. The master workbook is still in development so can't share currently.

    Hope that i've covered everything, if not let me know and i can elaborate a bit more!

    Best regards
    James
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,947

    Re: copy common cells and variable range from multiple worksheets to single master workboo

    Put this code into a standard codemodule in your master workbook, and name one sheet of that workbook "Summary", and store that in the folder with the ESS workbooks - I have assumed they are all named ESS- somthing....

    Also, create a subfolder named "Archive"

    Please Login or Register  to view this content.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    08-07-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: copy common cells and variable range from multiple worksheets to single master workboo

    Bernie, Apologies for the late response.

    Thinking about what i want, i've made things a little simpler (i hope!)....

    Basically, i need to copy a variable range of data, from the "SKU Information" sheet from each workbook in the following folder (C:\Users\richardson.js\Desktop\FCR DIRECTORY\SUBMITTED).

    The data range starts at B5 and ends in column AG, with a variable row number, determined by data entry into column B. However, this cell is populated by a formula, so i only need to find the last row with data in that cell.

    The copied data from the source files, needs to be pasted into the next available row starting from cell B6 in the "FCR Summary" sheet of the active workbook that is running the VBA.

    Once the data has been copied over, i would like the workbook to be closed and moved to an archive folder (C:\Users\richardson.js\Desktop\FCR DIRECTORY\ARCHIVE).

    Hope that this makes sense?

    Regards
    James

  4. #4
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,947

    Re: copy common cells and variable range from multiple worksheets to single master workboo

    "However, this cell is populated by a formula, so i only need to find the last row with data in that cell."

    What does that mean - is column B filled with formulas before values are entered into the other columns? Which column will always be filled in that would show the actual extent of the data entry?

  5. #5
    Registered User
    Join Date
    08-07-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: copy common cells and variable range from multiple worksheets to single master workboo

    Bernie,
    Column B has the formula, which will only provide a value, dependant on other criteria in the same row.
    So, last row should be found in column B.
    Thanks!

  6. #6
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,947

    Re: copy common cells and variable range from multiple worksheets to single master workboo

    I don't want to find the last row in column B, because it is filled with formulas and then the logic depends on the formula, and checking every cell. What column will be filled with entries that will show the last filled row? For example, if you enter values into column D for every entry, then I would use D to find the last entry.

  7. #7
    Registered User
    Join Date
    08-07-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: copy common cells and variable range from multiple worksheets to single master workboo

    Ok, understand. Say column X then, not at work so can't check. If ok, please highlight code that needs amending if it's wrong! Thank you


    Sent from my iPad using Tapatalk

  8. #8
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,947

    Re: copy common cells and variable range from multiple worksheets to single master workboo

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    08-07-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: copy common cells and variable range from multiple worksheets to single master workboo

    Thanks for this Bernie, but haven't you forgotten the code to paste values into FCR Summary sheet, on the next available line, starting at cell B5. Also for any files that are opened in the submitted directory, I need to disable the macros, as my company has a file classification macro to label each file as Highly restricted, restricted etc... Really appreciate ur help!


    Sent from my iPad using Tapatalk

  10. #10
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,947

    Re: copy common cells and variable range from multiple worksheets to single master workboo

    No, I did not forget - the .Copy _ Shtd..... is what does that. This will disable macros...

    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    08-07-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: copy common cells and variable range from multiple worksheets to single master workboo

    Bernie,

    Thanks for the code, we are nearly there.... really appreciate your help and patience with me!

    The only issues i have now are the following:-

    1) Is that on copying the range from "SKU Information" sheet, it only pastes the last row.

    The data within the "SKU Information" sheet is in a table, would it be easier to select that object, instead of finding the last row? Table name is "TABLE_SKU_INFORMATION".

    2) i need the values pasted, currently it is pasting the formulas over, (ie: requires paste special values?)

    If you could tweak the code i would be much appreciated!

    James

  12. #12
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,947

    Re: copy common cells and variable range from multiple worksheets to single master workboo

    Try this version..

    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    08-07-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: copy common cells and variable range from multiple worksheets to single master workboo

    Bernie, perfect-thanks!


    Sent from my iPad using Tapatalk

+ 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. Copy/Paste Range of Data from Multiple Workbooks/Worksheets to Master Workbook/Worksheets
    By NumberCruncher311 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-19-2013, 08:21 PM
  2. [SOLVED] Copy range from multiple sheets, into a master sheet and moving over by variable col range
    By g1eagle in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-23-2012, 01:36 PM
  3. [SOLVED] Copy range from multiple files in multiple folders to single sheet in master WB
    By Royzer in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 07-18-2012, 03:40 PM
  4. [SOLVED] Copy cells from multiple worksheets and workbooks to one master workbook
    By Concept in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-30-2012, 01:42 PM
  5. Copy data from multiple workbooks to a single master workbook
    By kishoremcp in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-11-2012, 03:44 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