PDA

View Full Version : Automation of Drop Down list



punty
04-17-2018, 10:08 PM
I have a dropdown in one of my sheets, selecting any one item in the dropdown updates 4 sheets and then the data in 4 sheets are converted into PDF.
I am facing problem in automating this step. I am able to generate PDF through Macro but in the drop-down list. I am not able to automate selection of entries.

Sub Test6()
'
' Test6 Macro
'
' Keyboard Shortcut: Ctrl+k
'
Range("B4:C4").Select
Application.Run "'Copy of North TSC Format (2).xlsm'!PDFActiveSheet"
Sheets("Talent Scorecard - CV Passenger").Select
Application.Run "'Copy of North TSC Format (2).xlsm'!PDFActiveSheet"
Sheets("Talent Scorecard - SCV Cargo").Select
Application.Run "'Copy of North TSC Format (2).xlsm'!PDFActiveSheet"
Sheets("Talent Scorecard - MHCV").Select
Application.Run "'Copy of North TSC Format (2).xlsm'!PDFActiveSheet"

I want this to repeat for other entries in the drop-down list.

Can anyone help me in this?

p45cal
04-18-2018, 06:06 AM
In the code, between each run of PDFActiveSheet, you neeed to change the value of the dropdown cell.
Let's say that cell is B2:

Sheets("the name of the sheet that cell B2 is on here").range("B2").value = "something"
Application.Run "'Copy of North TSC Format (2).xlsm'!PDFActiveSheet"
Sheets("Talent Scorecard - CV Passenger").Select
Sheets("the name of the sheet that cell B2 is on here").range("B2").value = "something else"
Application.Run "'Copy of North TSC Format (2).xlsm'!PDFActiveSheet"
…etc.changing what obviously needs changing in the code above.

If you know what the something and something else are you can write them into the code.
If they're liable to change, you can go to the source range of the data validation and iterate through those cells' values.

We'd need a bit more detail.