+ Reply to Thread
Results 1 to 17 of 17

Macro to Consolidate Staff Sheets by Months

  1. #1
    Forum Contributor
    Join Date
    06-03-2004
    Location
    India
    MS-Off Ver
    2013
    Posts
    205

    Macro to Consolidate Staff Sheets by Months

    Thanks for all your help and support
    Attached Files Attached Files
    Last edited by prkhan56; 05-03-2016 at 02:35 PM.

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

    Re: Macro to Consolidate Staff Sheets by Months

    I wasn't quite sure what you wanted to do with the other staff members. Are they each to be written to a separate staff file? Does the cell "mapping" from master to staff change by staff member? This code could be modified to loop through the staff members. Just tell us how you would like to handle that.
    Attached Files Attached Files
    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
    06-03-2004
    Location
    India
    MS-Off Ver
    2013
    Posts
    205

    Re: Macro to Consolidate Staff Sheets by Months

    Hi,
    Please see my reply under your queries.

    I wasn't quite sure what you wanted to do with the other staff members.
    As mentioned in my original post there is a folder C:\Test where there is a workbook for each Staff Member the names are same as shown in the Master File.

    Are they each to be written to a separate staff file?
    Yes please, each Staff details from Master should be written to separate staff file.

    Does the cell "mapping" from master to staff change by staff member?
    Yes it does, the sample I posted was only for Staff number 7 (which I mentioned as Staff 10, apologies for the error on my part)

    This code could be modified to loop through the staff members. Just tell us how you would like to handle that.
    I would like to run the Macro from the Control Panel made by you.
    The Page Path value in B2 Cell would be same in the Control Panel Sheet
    In B3 (Staff Page File) I can create a data validation to show the names of the Staff in C3 for Months.
    When I click the CopyStaff button. It should go and write the value of that particular staff in its respective workbooks shown in B3 and C3

    Hope this is clear.
    I am also attaching a file with colors to explain further.

    Thanks for your time and support
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    06-03-2004
    Location
    India
    MS-Off Ver
    2013
    Posts
    205

    Re: Macro to Consolidate Staff Sheets by Months

    Hi Dflak,
    Any update on my problem please.
    Thanks

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

    Re: Macro to Consolidate Staff Sheets by Months

    I need to know one more thing: are you doing this annually or once a month? In other words, do I have to loop through each month and fill in 12 pages, or do I find the current (or last) month and fill on only that page?

    I am making the assumption that you want the output to be named like: Staff_StaffMemberName.xlsx.

  6. #6
    Forum Contributor
    Join Date
    06-03-2004
    Location
    India
    MS-Off Ver
    2013
    Posts
    205

    Re: Macro to Consolidate Staff Sheets by Months

    Hi,

    I need to know one more thing: are you doing this annually or once a month?
    I will do once in a month

    In other words, do I have to loop through each month and fill in 12 pages, or do I find the current (or last) month and fill on only that page?
    You don't have to loop to all months. The data needs to be filled in each Staff file for that month. viz the current month

    I am making the assumption that you want the output to be named like: Staff_StaffMemberName.xlsx.
    The Folder C:\Test already has got files for each Staff1.xlsx, Staff2.xlsx, Staff3.xlsx and so on. The staff names are shown in Column A of the Master file. The macro should go to each Staff file and fill data from Master.xlsx shown against that Staff name

    Hope this is clear
    Thanks once again for your time.

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

    Re: Macro to Consolidate Staff Sheets by Months

    Here is my latest shot. It creates files Staff1, Staff2, etc. If the file does not exist, it creates it by copying in the blank "template," Staff Group.xlsx.
    Attached Files Attached Files
    Last edited by dflak; 04-26-2016 at 03:48 PM. Reason: Forgot Attachment

  8. #8
    Forum Contributor
    Join Date
    06-03-2004
    Location
    India
    MS-Off Ver
    2013
    Posts
    205

    Re: Macro to Consolidate Staff Sheets by Months

    I will test and revert
    Thanks for your time and help

  9. #9
    Forum Contributor
    Join Date
    06-03-2004
    Location
    India
    MS-Off Ver
    2013
    Posts
    205

    Re: Macro to Consolidate Staff Sheets by Months

    Hi,
    One small problem when I was conducting the test.
    There are also some blanks in Col A where the Staff are either on leave or left.

    So would you please amend the code to cater for any blanks encountered in Col A starting from A4 to A38
    So that it would run for all the Staff names in Col A and skip the blanks.

    thanks once again for all your time and help

  10. #10
    Forum Contributor
    Join Date
    06-03-2004
    Location
    India
    MS-Off Ver
    2013
    Posts
    205

    Re: Macro to Consolidate Staff Sheets by Months

    Hi dflak
    Is there any solution to the blanks in Col A please?

    Thanks for your time

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

    Re: Macro to Consolidate Staff Sheets by Months

    Just got back from vacation. I will have to take a look. It's not a big deal but I'll have to "get to it."

  12. #12
    Forum Contributor
    Join Date
    06-03-2004
    Location
    India
    MS-Off Ver
    2013
    Posts
    205

    Re: Macro to Consolidate Staff Sheets by Months

    Hope you had a nice time during vacation.
    I will wait for your reply

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

    Re: Macro to Consolidate Staff Sheets by Months

    I added a module that contains my standard last row lookup routine and I went down the list of Staff ignoring those that were blank.
    Attached Files Attached Files

  14. #14
    Forum Contributor
    Join Date
    06-03-2004
    Location
    India
    MS-Off Ver
    2013
    Posts
    205

    Re: Macro to Consolidate Staff Sheets by Months

    Hi,
    Thanks the current module ignore blanks but when I tested on my actual data I found couple of issues, if you could rectify them for me please.

    1) See image 'sheet name' - my sheet name has month and year eg: Jan 16, Feb 16 and so on
    2) If I try to put in Data Validation Jan 16, Feb 16, ....till Dec 16 it gets converted to 16-Jan, 16-Feb ....16-Dec.. see image 'Data Validation'
    3) If I run the macro then it comes with an error.. see image 'Error1'

    I tried to make the format mmm-yy etc but did not succeed.

    Thanks once again for all the time and support.

  15. #15
    Forum Contributor
    Join Date
    06-03-2004
    Location
    India
    MS-Off Ver
    2013
    Posts
    205

    Re: Macro to Consolidate Staff Sheets by Months

    Sorry forgot to attached the images.
    Here they are
    Attached Images Attached Images

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

    Re: Macro to Consolidate Staff Sheets by Months

    Your data validation should match what your tab names are and they should be a string, not a date. Either remove the data validation and type in the value manually or you can compute the tab name using =Text(Date(Year(Today()),Month(Today())-1,1),"mmm yy") assuming that you run the report after the first of the month for the previous month.

    The error you are showing is probably caused because you no longer have the name Month_Name defined. Go to Formulas -> Name Manager and see what it is pointing to. It should reference the cell with the tab name.

    The tab names in the master book should match the tab names in the staff books. That is an assumption I made.

  17. #17
    Forum Contributor
    Join Date
    06-03-2004
    Location
    India
    MS-Off Ver
    2013
    Posts
    205

    Re: Macro to Consolidate Staff Sheets by Months

    THANKS THANKS THANKS
    It is working now

    Thread also marked SOLVED

+ 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] Simple Staff cost budget - 12 months forecast
    By alex007 in forum Excel General
    Replies: 8
    Last Post: 07-23-2015, 12:04 PM
  2. [SOLVED] Consolidate - Payroll Staff
    By jantonio in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-02-2015, 02:05 PM
  3. [SOLVED] Macro to update Score Card Summary when the new staff add-in or existing staff deleted
    By Faridwahidi in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-12-2014, 02:43 PM
  4. [SOLVED] Macro to consolidate data from multiple sheets to one
    By jw01 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-12-2014, 11:58 AM
  5. [SOLVED] Macro to consolidate the excel sheets
    By akhileshgs in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-03-2013, 02:28 AM
  6. [SOLVED] consolidate over 50 sheets by Macro
    By Khoshravan in forum Excel General
    Replies: 7
    Last Post: 07-29-2006, 09:30 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