Hi,
Need help. See code below.
What it does are...
1. Worksheet1 (main worksheet) - calls each name on worksheet2, updates other cells based on data on worksheet3, and the code saves each separately as pdf
2. Worksheet2 (list of names) - there are list of names that needs to be looped
3. Worksheet3 (data) - data looked up by worksheet1
Output is separate pdf files for each name on worksheet.
What I want is for the code to save is as excel file (.xls)
Thanks!
Need help. See code below.
VBA Code:
Sub Create_PDF()
Application.ScreenUpdating = False
Dim rs1 As Worksheet, rs2 As Worksheet
Set rs1 = Worksheets("Sheet1")
Set rs2 = Worksheets("Sheet2")
myPath = "C:\Users\ELPADILL\OneDrive - Schenker AG\Desktop\2025 Target Agreement\2024 STIP1 Template & Letters\2024 Target Bonus"
For r = 2 To 6
empName = rs2.Cells(r, "B")
rs1.[B2] = empName
Set Rng = rs1.Range("A1:W41")
Rng.ExportAsFixedFormat Type:=xlTypePDF, Filename:=myPath & " - " & empName & ".pdf"
Next r
Application.ScreenUpdating = False
End Sub
What it does are...
1. Worksheet1 (main worksheet) - calls each name on worksheet2, updates other cells based on data on worksheet3, and the code saves each separately as pdf
2. Worksheet2 (list of names) - there are list of names that needs to be looped
3. Worksheet3 (data) - data looked up by worksheet1
Output is separate pdf files for each name on worksheet.
What I want is for the code to save is as excel file (.xls)
Thanks!