Share via

VBA code to loop each row into a template and save as pdf

Anonymous
2012-03-30T05:51:59+00:00

HI,

im hoping someone here can help me out to save hours of my workload.

Im trying to export the date in each row to a specific cell in the template, save the file as pdf and do the same to the next row.

let say if i have 50 rows the vba code will save individual 50 template .pdf files

The logic i think is

  1. For # of rows, for each row
  2. either open the template or move the data to next sheet
  3. Copy cells blah blah to new worksheet in specific cells to suit your formatting
  4. Use VBA to reformat new worksheet to desired specs
  5. Use VBA to save as PDF with filename the value of patient name and postcode
  6. Close the new worksheet that is now already saved
  7. Reiterate for next row, till last row is processed.

dummy worksheet below,

transfer A2(John) to a template say in sheet2  >> A2 = B2, B2=B3, C2=B4, D2=B5, E2=B6 and so on.

and save the new sheet file name as the value of patient name and Postcode.pdf then it will do the same to the next row until the cell is empty.

A1 B1 C1 D1 E1 F1 G1 <br> --- --- --- --- --- --- --- <br> Patient Name Address Suburb City Postcode Telephone Number Medication record <br> John AA <br> Jack AA <br> BB <br> XX <br> Kate CC <br> BB <br> Nick BB
appreciate the help. <br><br> <br><br>thanks!!!
Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Andreas Killer 144.1K Reputation points Volunteer Moderator
    2012-03-31T08:56:51+00:00

    There are very many questions and ambiguities in your request, the exact circumstances must be discussed first.

    This is nothing what can be done with a small marco, it sounds like a very large project.

    I recommend hiring an external programmer from your local area.

    Andreas.

    Was this answer helpful?

    0 comments No comments