Hi all,
I am trying to modify a project that I worked on a while ago where a macro would look at each value in a drop down list and export to PDF for each selection. What I am looking to change is adding one more dropdown into the equation.
For dropdown A I have 7 values stored (A1, A2, A3, A4, A5, A6, A7)
For dropdown B I will have 3+ values stored (B1, B2, B3,...this could be more or less based on the selection of Dropdown A)
I'm trying to make the macro select each combination and export them to a specific folder with the name of each file a concatenation of each dropdown selection
File 1:A1B1
File 2: A1B2
File 3: A1B3
File 4: A2B1
File 5:A2B2
File 6: A2B3
continuing for however many selections there are available.
Here is what I have in my current file that only takes into account one dropdown value.
Public Sub Create_PDFs()
Dim dataValidationCell As Range, dataValidationListSource As Range, dvValueCell As Range
Dim dropdownValue As String
Dim PDFfile As String, i As Long
Dim destinationFolder As String
destinationFolder = "C:\Users\ME\Desktop\Export\PDF"
'destinationFolder = "C:\path\to\folder" 'Or specific folder
If Right(destinationFolder, 1) <> "" Then destinationFolder = destinationFolder & ""
'Cell containing data validation in-cell dropdown
Set dataValidationCell = Worksheets("Lookup").Range("B1")
'Source of data validation list
Set dataValidationListSource = Evaluate(dataValidationCell.Validation.Formula1)
'Create PDF for each data validation value
For Each dvValueCell In dataValidationListSource
dataValidationCell.Value = dvValueCell.Value
With dataValidationCell.Worksheet
.ExportAsFixedFormat Type:=xlTypePDF, Filename:=destinationFolder & " " & dvValueCell.Value & ".PDF", _
Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
End With
Next
End Sub
Any help in modifying this to accommodate another dropdown layer would be greatly appreciated!
Thanks!
I am trying to modify a project that I worked on a while ago where a macro would look at each value in a drop down list and export to PDF for each selection. What I am looking to change is adding one more dropdown into the equation.
For dropdown A I have 7 values stored (A1, A2, A3, A4, A5, A6, A7)
For dropdown B I will have 3+ values stored (B1, B2, B3,...this could be more or less based on the selection of Dropdown A)
I'm trying to make the macro select each combination and export them to a specific folder with the name of each file a concatenation of each dropdown selection
File 1:A1B1
File 2: A1B2
File 3: A1B3
File 4: A2B1
File 5:A2B2
File 6: A2B3
continuing for however many selections there are available.
Here is what I have in my current file that only takes into account one dropdown value.
Public Sub Create_PDFs()
Dim dataValidationCell As Range, dataValidationListSource As Range, dvValueCell As Range
Dim dropdownValue As String
Dim PDFfile As String, i As Long
Dim destinationFolder As String
destinationFolder = "C:\Users\ME\Desktop\Export\PDF"
'destinationFolder = "C:\path\to\folder" 'Or specific folder
If Right(destinationFolder, 1) <> "" Then destinationFolder = destinationFolder & ""
'Cell containing data validation in-cell dropdown
Set dataValidationCell = Worksheets("Lookup").Range("B1")
'Source of data validation list
Set dataValidationListSource = Evaluate(dataValidationCell.Validation.Formula1)
'Create PDF for each data validation value
For Each dvValueCell In dataValidationListSource
dataValidationCell.Value = dvValueCell.Value
With dataValidationCell.Worksheet
.ExportAsFixedFormat Type:=xlTypePDF, Filename:=destinationFolder & " " & dvValueCell.Value & ".PDF", _
Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
End With
Next
End Sub
Any help in modifying this to accommodate another dropdown layer would be greatly appreciated!
Thanks!