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.
See the attached version. It is now a macro-enabled workbook so you'll have to allow macros when you open it.
- jhuskeyOct 07, 2021Copper ContributorWow.. how did you do that? I'm not sure I understand macros.
THANK YOU- HansVogelaarOct 07, 2021MVP
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