I have a workbook with the following named sheets: Input, Presentation, Results.
The Results sheet has rows of information that is shown in Presentation sheet via cell B2 in the Input sheet. B2 starts with the value 1, that looks up range A5:A5000 in Results sheet. Changing cell B2 in Input changes the Presentation sheet.
I'm looking for a code for a macro that will take the value in cell B2 of "Input" sheet, save the "Presentation" sheet as a PDF by name of what is in cell B4 of "Input" sheet, add 1 to the value in cell B2 of "Input" sheet and loops until if finds an empty cell in range A5:A5000 in "Results" sheet.
I want the files saved one by one in the same folder.
This is my code:
Sub ProjectionStatementRecord()
' ProjectionStatementRecord Macro
Sheets("Results sheet").Activate
Range("A4").Select
Do While True
If Selection.Value = "" Then
Exit Do
Else
Sheets("Input sheet").Activate
Range("B3").Select
Selection.Copy
Sheets("Presentation").Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\Users\Kristine\Desktop\Retirement Projection\" & Selection.Text & ".pdf" _
, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=False
Sheets("Results sheet").Activate
Selection.Offset(1, 0).Select
End If
Loop
End Sub
I am getting an error that says "file not saved"
Please help.