+ Reply to Thread
Results 1 to 6 of 6

Automatic update of master workbook with changing target workbooks

  1. #1
    Registered User
    Join Date
    06-09-2017
    Location
    Leeds, England
    MS-Off Ver
    Microsoft 365
    Posts
    35

    Automatic update of master workbook with changing target workbooks

    Hi Folks

    I have created a workbook that monitors performance for an individual against pre-set objectives.

    What I now want to do is create a manager's workbook that collates the information for each team member and works out the team average.

    I know how to do this by manually linking spreadsheets however the business I'm in can have anywhere between 4 and 15 members in a team, and these members can change and move around.

    I would like a VBA script that can search for the workbooks that contain the data, take a specific sheet from each workbook and populate a sheet in the manager's document.

    If possible it would be able to add a sheet when a new member is added, remove a sheet when a member leaves and rename each sheet to the staff members name (this is captured on their individual workbooks)

    I have found several examples of looping through a directory to find other workbooks but normally they are single sheet documents. From the description on the site, this is the nearest script to what I want that I have found, but it doesn't seem quite right for what I want. (Although I'm new to VBA so I'm not 100% sure)

    Sub Merge2MultiSheets()
    Dim wbDst As Workbook
    Dim wbSrc As Workbook
    Dim wsSrc As Worksheet
    Dim MyPath As String
    Dim strFilename As String

    Application.DisplayAlerts = False
    Application.EnableEvents = False
    Application.ScreenUpdating = False
    MyPath = "C:\Path" ' change to suit
    Set wbDst = ThisWorkbook
    strFilename = Dir(MyPath & "\*.xls", vbNormal)

    If Len(strFilename) = 0 Then Exit Sub

    Do Until strFilename = ""

    Set wbSrc = Workbooks.Open(Filename:=MyPath & "\" & strFilename)

    Set wsSrc = wbSrc.Worksheets(1)

    wsSrc.Copy After:=wbDst.Worksheets(wbDst.Worksheets.Count)
    ActiveSheet.Name = strFilename

    wbSrc.Close False

    strFilename = Dir()

    Loop
    wbDst.Worksheets(1).Delete

    Application.DisplayAlerts = True
    Application.EnableEvents = True
    Application.ScreenUpdating = True

    End Sub

    I have uploaded a blank version of what I want the manager workbook to look like, the numbered tabs should update themselves to the different staff names, and the first page should average each area for each month.
    The 2017 121 document is what each staff member would be filling in and the Adam 121 workbook is what it will look like as it is used.

    I want the manager workbook to take the '121 Data' sheet from each staff workbook in their particular team folder.

    Thanks in advance
    Last edited by KidZest; 06-13-2017 at 08:32 AM.

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

    Re: Automatic update of master workbook with changing target workbooks

    I get that the Manager Practice sheet is where you want to collect the data.

    When I look at the person's sheet. It appears that there are two possible source sheets fro this data: 121 Data and Rating. Which do you want to feed into the manager's sheets?

    Also I can name the tabs with the people's names instead of numerically. How will these files be named? Jane Jones xxxxx.xlsx or Jones, Jane xxxxxx.xlsx - if I can, I would like to present the names alphabetically.
    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
    Registered User
    Join Date
    06-09-2017
    Location
    Leeds, England
    MS-Off Ver
    Microsoft 365
    Posts
    35

    Re: Automatic update of master workbook with changing target workbooks

    Hi thank you for your help.

    I would like the manager's workbook to have a sheet that shows the tables and values from the '121 Data' sheet from each employee workbook.

    Currently there is no set way for the files to be named. I've stepped beyond what my current project is running and doing the managers sheet in my own time. Depending on the logistics they could feasibly be named in anyway.

    It would be useful to keep to the same file path and naming structure in use, but not entirely necessary.

    Currently we have a folder distribution that looks like this:

    S:/OM Area/OTM Name/EO_STATS/*****.xlsx (mine would be ATAYLORSTATS)

    I want to utilise the first few folders and add a second one in each OTM (manager) folder called EO_121DATA

    So the one attached above would be saved in:

    S:/Karens Area/KABBOTT/EO_121DATA/ATAYLOR121.xlsx

    With the file path above, there's approximately 5-8 different 'OM Areas' each with anywhere between 4 and 10 'OTM Names' which can then have between 6 and 15 staff in their team.

    Questions

    Is it possible to use the cell value at the top of the sheet with the staff name in, to name the worksheet on the manager's document?

    Does VBA let you set it up so it looks in the relative directory for the target folder (EO_121DATA) and files inside? In effect allowing a blank copy of both files and folder structure to be kept in case new teams are created with new managers as the company grows in size?

    Basically i want to automate as much of this as possible so that it can be used by anyone in future and doesn't require just me to maintain and update.

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

    Re: Automatic update of master workbook with changing target workbooks

    1. I'll give you a cell where you can enter in where the team folders are kept.

    2. Explain to me what you mean by "I want to utilise the first few folders and add a second one in each OTM (manager) folder called EO_121DATA." I'm not quite sure what you mean by that. The way I am reading it now is that Karen's manager's report will be in S:/Karen's Area/KABBOTT and her team members will be in a sub folder called EO_121Data. Is this correct? This seems to conflict with the current scheme being: S:/OM Area/OTM Name/EO_STATS/*****.xlsx.

    3. The number of people in a sub-folder doesn't matter and if a person changes a team, simply move them from one folder to the other.

    4. If I read the first question correctly, you want to use the value in cell B2 on the 121 Data sheet to name the workbook sheet. This can be done.

    5. If I'm reading the second question correctly, I think I can accommodate you. You tell it where the new team folder is and the program will find it.

    Attached is a picture of what I roughed out so far. I envisioned that the managers have their spreadsheets in this folder. The master folder is the "root directory" for the enterprise. The manager's folder is where the spreadsheets for the people reporting to the manager are kept. I can change this to add an additional level:
    - Master folder = S:/OM Area
    - Manager folder = OTM Name (sub-folder to Master folder)
    - Team Folder = EO_Stats (sub-folder to Manager Folder where the individual folders are kept)

    So the directory structure for Karen would be: S:\Karen's Areas\KABBOTT\EO_121DATA - I think this is what you want.

    One thing I'll have to work out is to alphabetize the tabs based on the names. Are the names stored as first last or last, first?
    Attached Images Attached Images

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

    Re: Automatic update of master workbook with changing target workbooks

    Attached is a spreadsheet that I think will do what you want. Fill in the folder names on the Control Panel Sheet. I think you want:
    - Master folder = S:/Karen's Area
    - Manager folder = KABBOTT
    - Team Folder = EO_Stats

    You will notice that there are two tabs called Start and End. These are used as "markers" for determining which sheets are personnel sheets and for keeping the Team Average formulas accurate.

    The team average formulas look like: =IFERROR(AVERAGE(Start:End!D6),"") - this formula takes the average of all the cell D6 for all sheets between and including start and finish. Since the start and finish tabs are blank (no data) the average formula will ignore them.

    When you run the program, it deletes all sheets between start and end, goes out to the team folder and copies in the 121 Data sheet into a new sheet named for the person in cell B2 on the sheet. I noticed that the names were first last in this cell and I converted the sheet name to be last, first. The program sorts the sheet names in alphabetical order.

    You can see how this scheme will keep up with re-assignments of team members.

    You can hide the start and end tabs, I left them showing for the purposes of explanation. You can also hide the Sheet List tab. The Sheet List tab is used to sort the sheets.

    About the only thing that can go wrong with the program is if you have two people with the same name on the same team.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    06-09-2017
    Location
    Leeds, England
    MS-Off Ver
    Microsoft 365
    Posts
    35
    That sounds perfect. I'm currently travelling and will have a look when I get home.

    I'm sure it works great, but I'll post back to let you know either way.

    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. [SOLVED] Update rows from master workbook to all other workbooks based on ID
    By bkrajeshkumar in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-14-2015, 12:47 PM
  2. Linking Workbooks to update Master Workbook
    By RichTea88 in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 02-05-2013, 08:17 AM
  3. Replies: 16
    Last Post: 11-05-2012, 07:16 AM
  4. How to update master workbook with links to other workbooks
    By Launchnet in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 01-09-2012, 06:16 AM
  5. Update external workbooks with changes made in master workbook
    By colton in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-01-2010, 01:15 PM
  6. Replies: 2
    Last Post: 05-22-2007, 07:15 AM
  7. Update master workbook from individual workbooks
    By Annabelle in forum Excel General
    Replies: 0
    Last Post: 02-16-2006, 02:10 PM

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