This project automates staff rostering and generates detailed analysis reports directly within Excel using VBA. It is designed to simplify shift assignment, track actual vs. planned duties, and generate summary reports for effective duty management.
-
Automated Roster Duplication
- Create timestamped copies of the main roster for record-keeping.
- Automatically removes all buttons and form controls in the duplicated sheet.
- Protects the duplicated sheet for view-only access.
-
Shift Analysis Report
- Generate slot-wise analysis for:
- Loan Mail Box
- Morning
- Afternoon
- AOH
- Saturday AOH
- Compare system-generated duty counts against actual roster counts.
- Highlight discrepancies with clear differences and % difference.
- Generate slot-wise analysis for:
-
Total Summary Table
- Combine data from all shift analysis tables.
- Sum up all counters across slots into one consolidated view.
- Automatically handle empty tables (no staff) gracefully.
-
Sheet Protection & Password Authentication
- Protect roster sheets with a password (
rostering2025). - Prompt users to enter the password before running key operations.
- Protect roster sheets with a password (
-
Customizable Workflow
- Prompt users to select the
ActualRoster_*sheet for analysis. - Automatically names the analysis sheet as
AnalysisReport_YYYYMMDD_HHMM.
- Prompt users to select the
- Excel Version:
- Microsoft Excel 2016 or later
- Microsoft 365 (Recommended for best compatibility)
- Macros:
- Macros must be enabled.
- VBA Reference Libraries:
- No external libraries required (uses built-in VBA objects like
Scripting.Dictionary).
- No external libraries required (uses built-in VBA objects like
| Module/Procedure | Description |
|---|---|
DuplicateActualRoster |
Duplicates the roster sheet, removes buttons, and protects it. |
MasterGenerateAllAnalyses |
Master procedure to generate all shift analyses and summary reports. |
GenerateShiftAnalysisBlock |
Generates an individual shift analysis table (slot-wise). |
GenerateTotalSummaryTable |
Combines all shift analysis tables into one total summary. |
ProtectRosterSheet |
Protects the roster sheet with a predefined password. |
UnprotectRosterSheet |
Prompts the user for a password to unprotect the roster sheet. |
-
Open the Workbook
- Enable macros when prompted.
-
Generate a Roster Copy
- Run
DuplicateActualRosterto create a newActualRoster_*sheet.
- Run
-
Populate the Roster
- Assign shifts using the main
Rostersheet.
- Assign shifts using the main
-
Generate Analysis
- Run
MasterGenerateAllAnalyses. - Select an
ActualRoster_*sheet when prompted. - Enter the password (
rostering2025) if required. - View the generated report in
AnalysisReport_YYYYMMDD_HHMM.
- Run
-
Review Total Summary
- The summary table will be generated to the right of the individual analyses.
| Action | Password |
|---|---|
| Protect roster sheet | rostering2025 |
| Protect analysis report | nuslib2017@52 |
- Start with a base
Rosterโ Duplicate usingDuplicateActualRoster. - Edit the new roster (
ActualRoster_20250728_2328) with actual data. - Generate Analysis Report โ A new
AnalysisReport_20250728_2328will be created. - Check Summary Table โ Validate staff duty distribution across all shifts.
- Ensure staff lists are correctly filled; blank personnel lists will generate empty analysis tables.
- The macro skips missing tables but still creates placeholders in the analysis report.
- Protecting sheets prevents accidental edits but allows sorting and filtering.