Hi, hoping someone can help. Think it's quite simple but I'm stuck! I have the following code which loops through a dropdown on Sheet1 and subsequently prints two other worksheets to PDF. Both worksheets have a cell linked to G5 on Sheet 1 and values in those worksheets should update based on each selection before the PDFs are printed but they're not updating. I therefore get 30 PDFs with the same values on. How do I get the two other worksheets to update as each dropdown value is looped through? Many thanks in advance.
Code:
Sub Create_pdf_pack()
Dim dvCell As Range
Dim inputRange As Range
Dim c As Range
Set dvCell = Sheets(1).Range("G5")
Set inputRange = Evaluate(dvCell.Validation.Formula1)
For Each c In inputRange
[G5] = c.Value
'you might need to refresh the sheet here
ThisWorkbook.Sheets(Array("Targets - Retailer PDF", "Model Sheet - Retailer PDF")).Select
ActiveSheet.Calculate
ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:="G:\MBC National Sales\Forecast\2020\Targets\Targets & model Retailer\2020 Target & Model " & c.Value, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
Next c
MsgBox "All PDF's have been successfully exported."
End Sub
Last edited by a moderator: