Macro Selects Directory to Save File Based on Sheet Criteria

W

watchtower

I am trying to set up a macro that looks in the contents of a cell, for
example E9, and determines the file path and file name to save the file. E9
will contain a date. Based on the date, the macro will need to select the
correct folder:

Cell E9 = 8/9/07
File path & name = C:\2007\(08) August\MCBS 08-09-2007.xls

Any suggestions?

I appreciate it.
Adam
 
B

Bob Phillips

mpPath ="C:\" & Year(Range("E9").Value) & "\(" & Format(Range("E9").Value,
"mm) mmmm") & "\MCBS " & Format(Range("E9").Value, "mm-dd-yyyy")

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
J

Jim Jackson

a = Format(Range("E9"), "yyyy") ' 2007
b = Format(Range("E9"),"("& "mm" &")") ' (08)
c = Format(Range("E9"),"mmmm") ' August

ActiveWorkbook.Saveas Filename:="C:\" & a & "\" & b & " " & c & "\MCBS
08-09-2007.xls"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top