On Oct 2, 12:41*pm, Michael Lanier <michaelrlan...@gmail.com> wrote:
> I want to change the name of my file "Estimation File" to "Master
> File" when I save it to (or if it's already in) my C drive. *Sheet1!A1
> has a formula that returns either 0 or 1. *Following are the
> conditions:
>
> If Sheet1!A1 = 0 and file is in C drive, then no change to file name
> If Sheet1!A1 = 1 and file is in C drive, then change file name to
> "Master File"
> Chane occurs only when the file is saved in/to C drive
>
> Thanks for any solution you might have.
>
> Michael
Try this. I left in the "ask if overwrite" on purpose
Sub savefile()
If Sheets("Sheet1").Range("a1") = 1 Then
fn = "Master File.xls"
Else
fn = ThisWorkbook.Name
End If
ActiveWorkbook.SaveAs Filename:=fn, FileFormat:= _
xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
End Sub
|