How to Automate Printing Employee Timesheets from an Excel Template
Question details
The user wants to automate the process of populating and printing an Excel timesheet template using data from a master employee list.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Generating and printing multiple completed timesheets for different employees without repetitive manual data entry.
- Observed behavior
- Looking for an automated solution combining lookup formulas and a macro-driven template to streamline the repetitive printing workflow.
Ensure your master employee list is well-organized with clear column headers (e.g., Employee ID, Name, Title), and save a backup copy of your workbook before running any new VBA macros.
Use a VBA Macro for Automated Batch Printing
Create a VBA script that loops through your master employee list, automatically updates the timesheet template for each person, and sends it directly to the printer.
Using a VBA macro is the most efficient method for handling a large number of employees. It eliminates the need to manually create dozens of worksheet copies and prevents tedious data entry errors.
In your timesheet template, designate a specific target cell for the Employee ID. Use XLOOKUP or INDEX and MATCH formulas in the Name, Title, and Department cells to automatically fetch data based on the Employee ID entered in the target cell.
Press ALT + F11 on your keyboard to open the Visual Basic for Applications (VBA) editor. Click on 'Insert' in the top menu and select 'Module' to create a new blank script window.
Write a VBA script that iterates through the rows of your master employee list. For each row, the script should copy the Employee ID, paste it into the template's target cell, force the sheet to recalculate, and execute the Worksheet.PrintOut command.
Close the VBA editor and return to your Excel workbook. Press ALT + F8 to open the Macro dialog box, select your newly created print macro, and click 'Run' to begin the batch printing process.

Use Lookup Formulas and Print Entire Workbook
If you prefer not to use VBA, you can duplicate your timesheet template manually, link each sheet to a different employee via formulas, and print them all at once.
Streamline Your Timesheet Printing with WPS Spreadsheet
WPS Spreadsheet is a powerful tool that natively supports complex lookup formulas and VBA macros, making it incredibly easy to automate repetitive workflows like timesheet generation and batch printing.
- 1. Prepare your employee master list: Open WPS Spreadsheet and organize your employee data with clear column headers in a dedicated master sheet.
- 2. Design the timesheet template: Create a new sheet formatted as your timesheet, utilizing WPS's built-in XLOOKUP formulas to pull data automatically from the master list.
- 3. Enable and run macros: Navigate to the Developer tab, open the VBA Editor to insert your batch printing loop code, and run it to print all timesheets instantly.

Frequently Asked Questions
What is the best Excel formula to pull employee data into a template?
XLOOKUP is highly recommended as it is versatile, easy to use, and searches in any direction. Alternatively, an INDEX and MATCH combination is excellent for backward compatibility with older spreadsheet software versions.
Can I modify the VBA macro to save timesheets as PDFs instead of printing them?
Yes. Instead of using the Worksheet.PrintOut command in your VBA loop, you can use the Worksheet.ExportAsFixedFormat method with the type set to xlTypePDF. This will save each populated timesheet as a separate digital PDF file on your computer.
Why are my lookup formulas returning an #N/A error in the template?
An #N/A error usually indicates that the lookup value (such as the employee ID or name) in your template does not perfectly match any entry in your master list. Check both cells for accidental typos, trailing spaces, or differences in cell formatting (e.g., text vs. numbers).




