Hello,
I use the below bit of code to loop through all items in a cell which contains a drop-down list (data validation) and to pdf the ActiveSheet.
It works great, apart for a minor problem: since the macro ends by selecting the last item in the drop-down list, every time, I have to manually "reset" it to select the first item.
I was wondering if there is way to have the macro always select the first item in the list, irrespective of what item is currently select, and also to automatically reset the list at the end of the loop.
Thank you.
I use the below bit of code to loop through all items in a cell which contains a drop-down list (data validation) and to pdf the ActiveSheet.
It works great, apart for a minor problem: since the macro ends by selecting the last item in the drop-down list, every time, I have to manually "reset" it to select the first item.
I was wondering if there is way to have the macro always select the first item in the list, irrespective of what item is currently select, and also to automatically reset the list at the end of the loop.
Thank you.
VBA Code:
'''' Location of DataValidation cell
Set r = Worksheets("Call Letter").Range("C2")
'''' Get DataValidation values
Set inputRange = Evaluate(r.Validation.Formula1)
'''' Loop through DataValidation list
For Each c In inputRange
If c <> "" Then
r.Value = c.Value
fName = c.Value
Worksheets("Call Letter").ExportAsFixedFormat Type:=xlTypePDF, Filename:=FolderName & ActiveSheet.Range("AttachFileName"), _
Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
End If
Next c