Forum Discussion
How do I automate and populate multiple separate forms from excel data?
- Oct 07, 2021
You can view the code as follows:
Press Alt+F8.
Select GenerateForms.
Click Edit.
The code determines the last used row in column B.
Then it loops through the rows from row 2 to the last row.
Depending on the type of review, it copies the Standard Review sheet or the Supervisory Review sheet to a new workbook.
It copies the contents of the cells in columns B, D, E and F to the appropriate cells in the review.
Finally it saves the new workbook with the name of the employee in the same folder as the template workbook.
THANK YOU
You can view the code as follows:
Press Alt+F8.
Select GenerateForms.
Click Edit.
The code determines the last used row in column B.
Then it loops through the rows from row 2 to the last row.
Depending on the type of review, it copies the Standard Review sheet or the Supervisory Review sheet to a new workbook.
It copies the contents of the cells in columns B, D, E and F to the appropriate cells in the review.
Finally it saves the new workbook with the name of the employee in the same folder as the template workbook.
- Accountant85Jul 10, 2024Copper Contributor
Hi Hans,
Are you able to alter the code to save the file to PDF rather than XLS?
I tried altering the below section of code with no luck.
wTrg.SaveAs Filename:=wSrc.Path & "\" & sSrc.Range("B" & r).Value & ".xlsx", _
FileFormat:=xlOpenXMLWorkbook- HansVogelaarJul 10, 2024MVP
Use
wTrg.ExportAsFixedFormat Type:=xlTypePDF, Filename:=wSrc.Path & "\" & sSrc.Range("B" & r).Value & ".pdf"
- jhuskeyOct 13, 2021Copper ContributorThank you!!