auto save file basedon dropdown selectiom


how do i save a file to a certian folder based on a selection from a dropdown box.

dropdown - 1st, 2nd, 3rd

folders - 1st shift, 2nd shift, 3rd shift

I already have a macro that will save the file to a folder but I want to be able to save to one of three folders based on the dropdown choice.  any ideas?




You need just to get the value from the cell with the drop down box, bring it into the macro, check which value it is, and change the folder location based on that.

These two tutorials from us will show you how to do all of that:

Get Data from the Worksheet into a Macro in Excel

VBA IF Statement in Excel Macros


Here is a sample:

Sub filesave()

'value from dropdown
dropValue = Range("A1").Value

ActiveWorkbook.SaveAs ("I:\BLM_Public\BloomsburgReports\DailySuperVisorReport2016\" & dropValue & Format(Now(), "DD-MMM-YYYY hh mm AMPM") & ".xlsm")

End Sub

Change A1 to the cell that contains the drop down.

Put dropValue anywhere in the saving file path. I just put it before the date part.



Below is what I have, however I want to save to one of three subfolders under "DailySuperVisorReport2016" 1st, 2nd, 3rd based on the selection from a dropdown box.  What do I need to add to my Macro?

Sub filesave() 'Update 20141111 ActiveWorkbook.SaveAs ("I:\BLM_Public\BloomsburgReports\DailySuperVisorReport2016\" & Format(Now(), "DD-MMM-YYYY hh mm AMPM") & ".xlsm") End Sub

Noyl Nov 30, '16 at 12:11 am
Answer updated. See if it helps.
don (rep: 1492) Dec 2, '16 at 4:32 am
Add to Discussion

Answer the Question

You must create an account to use the forum. Create an Account or Login