D
donh
Hi,
I have used some VBA from another posting which allows cell values to
be incorporated into a file name. I have added Now() onto my
worksheet and added an if statement that returns Now() date if a
refrence number is not present.
I have also created a very crude way of updating Now() when saving.
As you may of seen from other posts I am very new to VBA and although
this works, I would really like to how it could of best been done.
Sub Save()
Application.ScreenUpdating = False
ActiveSheet.Protect DrawingObjects:=False, Contents:=False,
Scenarios:=False
Range("E12").Select
Selection.Copy
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True
With ActiveWorkbook
.SaveAs Filename:="D:\Test\" _
& .Worksheets("sheet1").Range("B12").Value & ".xls", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
End With
End Sub
Many thanks
DonH
I have used some VBA from another posting which allows cell values to
be incorporated into a file name. I have added Now() onto my
worksheet and added an if statement that returns Now() date if a
refrence number is not present.
I have also created a very crude way of updating Now() when saving.
As you may of seen from other posts I am very new to VBA and although
this works, I would really like to how it could of best been done.
Sub Save()
Application.ScreenUpdating = False
ActiveSheet.Protect DrawingObjects:=False, Contents:=False,
Scenarios:=False
Range("E12").Select
Selection.Copy
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True
With ActiveWorkbook
.SaveAs Filename:="D:\Test\" _
& .Worksheets("sheet1").Range("B12").Value & ".xls", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
End With
End Sub
Many thanks
DonH