create unique forms from excel data set

daikeda

New Member
Joined
Apr 30, 2021
Messages
2
Office Version
  1. 365
Platform
  1. Windows
looking for if there's a way to create a one page unique "form/template" in excel thats based off data from another worksheet. below pictures are a simplified example. i would want to have all my information on Sheet2 and create a PDF filled out form based off the table values for each row. so in below example i would end with having 5 unique PDF, one for each person.

1619823963215.png

1619823976261.png
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Use lookup formulas to fill your "Form" worksheet from the "Records" worksheet. e.g.
VBA Code:
'https://social.msdn.microsoft.com/Forums/en-US/9f9a1483-14ad-4de3-8893-57b5e6892fcc/create-a-macro-to-print-a-report-as-a-pdf-and-then-move-to-next-report-in-dropdown-list-to-create?forum=exceldev
Sub Main()
  Dim p$, pdf$, r As Range, c As Range, dd As Range
  
  'p = "C:\Users\ken\Research\Company Research\Company Reports Kath Test\"
  p = ThisWorkbook.Path & "\t\"
  
  Set dd = [E2]
  Set dd = [E3]
  
  Set r = Range(dd.Validation.Formula1)
  'Debug.Print dd.Validation.Formula1
  'Debug.Print r.Address(external:=True)
  For Each c In r
    dd = c  'Update lookups formulas by dropdown value
    pdf = p & c & " " & Format(Date, "yyyymmdd") & ".pdf"
    ActiveSheet.ExportAsFixedFormat xlTypePDF, pdf
  Next c
End Sub

'http://www.excelforum.com/excel-programming-vba-macros/1121387-print-pdf-using-loop-condition-problem.html
Sub CreatePayslips()
  Dim pdf As String, i As Integer
  Dim r As Range, c As Range
  Dim wb As Workbook, iwc As Integer
  
  pdf = ThisWorkbook.Path & "\Payslips.pdf"
  
  With Application
    .DisplayAlerts = False
    .EnableEvents = False
    .Calculation = xlCalculationManual
    .ScreenUpdating = False
  End With
  
  On Error GoTo EndNow
   
  'Make scratch workbook
  Set wb = Workbooks.Add  'scratch workbook
  iwc = Worksheets.Count
  With ThisWorkbook
    Set r = .Worksheets("Payroll").Range("A3", _
      .Worksheets("Payroll").Range("A3").End(xlDown))
    For Each c In r
      .Worksheets("Payslip").Range("E3").Value2 = c.Value2
      .Worksheets("Payslip").Calculate
      .Worksheets("Payslip").Copy after:=wb.Worksheets(wb.Worksheets.Count)
    Next c
  End With
   
  'Remove blank worksheet(s) from scratch workbook
  For i = 1 To iwc
    Worksheets(1).Delete
  Next i
  Worksheets.Select
  
  ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=pdf _
  , Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
  :=False, OpenAfterPublish:=True
  
  wb.Close False
  
EndNow:
  With Application
    .DisplayAlerts = True
    .EnableEvents = True
    .Calculation = xlAutomatic
    .ScreenUpdating = True
  End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,036
Messages
6,122,794
Members
449,095
Latest member
m_smith_solihull

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top