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
Bookmarks