PDA

View Full Version : VBA: Export to PDF combination of cells



hugoslater
03-03-2020, 01:52 PM
Hi all,

I have the following code but I need it to export a combination set in column C & D instead of running all combinations of C & D. Is it possible?

Sub PDFBEORes()
Dim R As Range
Dim S As Range
Dim T As Range
Dim Counter As Long
Dim Folder
Folder = GetFolder
For Each R In Sheets("Cockpit").Range("C117:C118")
For Each S In Sheets("Cockpit").Range("L4")
For Each T In Sheets("Cockpit").Range("D117:D118")
If Not IsEmpty(R) Then
Range("U3") = R
Range("X3") = T
Counter = Counter + 1
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
Folder & "" & Counter & "." & R.Value & S.Value & T.Value, Quality:= _
xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
OpenAfterPublish:=False
End If
Next
Next
Next
MsgBox "Export to PDF completed"
End Sub

Thanks,
Hugo