Automatically Populate and Print Employee Timesheets in Excel
Question details
Automatically insert each employee's name into a timesheet template and print a completed copy.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Employee names are listed on one worksheet, and a separate worksheet contains the timesheet template.
- Observed behavior
- The desired result is one printed timesheet for each employee, populated with that employee's name.
Place employee names in Sheet1 column A starting at A2, and put the timesheet template on Sheet2 with the name field in C1. Check the template's print area and printer settings before running the macro; adjust the sheet names and cell references if your workbook differs.
Use a VBA macro to populate and print each timesheet
Use this method to print a separate copy of the template for every name in the employee list.
The macro finds the last used row in Sheet1 column A, writes each name to Sheet2 cell C1, and prints Sheet2. Keep the employee list free of blank rows, since the macro also prints rows with blank names.
In Excel, select File > Save As and choose Excel Macro-Enabled Workbook (.xlsm).
Open the Developer tab and select Visual Basic. In the editor, select Insert > Module.
Paste the following code into the module: Sub PrintTimeSheets() Dim sourceSheet As Worksheet Dim templateSheet As Worksheet Dim rowNumber As Long Dim lastRow As Long Set sourceSheet = ThisWorkbook.Worksheets("Sheet1") Set templateSheet = ThisWorkbook.Worksheets("Sheet2") lastRow = sourceSheet.Cells(sourceSheet.Rows.Count, "A").End(xlUp).Row For rowNumber = 2 To lastRow templateSheet.Range("C1").Value = sourceSheet.Cells(rowNumber, "A").Value templateSheet.PrintOut Next rowNumber End Sub
Test with a workbook containing one employee name and a printer or PDF output. In Excel, select Developer > Macros, choose PrintTimeSheets, and select Run. Once the result is correct, run it with the full employee list.

Populate and print timesheets with WPS Spreadsheets
In a WPS Spreadsheets installation that supports VBA macros, use the same employee list and template layout to populate and print timesheets. VBA availability and compatibility depend on your WPS version and configuration.
- 1. Open the workbook: In WPS Spreadsheets, select Open and choose the Excel workbook containing the employee list and timesheet template.
- 2. Check the layout: On Sheet1, check that employee names start in A2. On Sheet2, check that C1 is the template's name field and review the print area.
- 3. Add the macro: If your WPS installation supports VBA, open the Developer tab, select Visual Basic, insert a module, and paste the PrintTimeSheets macro above. Save the workbook as an XLSM file.
- 4. Test the print run: Use Developer > Macros to run PrintTimeSheets with one employee first. Check the printer or PDF result before running the full list.

Frequently Asked Questions
How do I change where the macro reads employee names?
In the VBA editor, change the Sheet1 reference and the column A references to match your list. Change the starting row in For rowNumber = 2 To lastRow if the first name is not in row 2.
How do I put the employee name in a different template cell?
In the macro, replace templateSheet.Range("C1") with the cell address used by your timesheet, such as templateSheet.Range("B3").
Why is the macro printing a blank timesheet?
The macro prints every row from A2 through the last used row in column A, including blank rows between names. Remove blank rows from the employee list before running it.
Can I test the timesheet without using paper?
Select a PDF printer in your print settings, then run the macro with one employee name. Some PDF printers ask for a separate filename for each printed sheet.




