close

Hi

Is it possible to use a macro to retrieve a value within a specific
cell and save the workbook using that value for the file name?

For example if the cell A1 had the value details, then the macro would
save the workbook as details.xls

Thank you in advance for any help !!--
mabbutt
------------------------------------------------------------------------
mabbutt's Profile: www.excelforum.com/member.php...oamp;userid=34294
View this thread: www.excelforum.com/showthread...hreadid=541058Here's some code you can use to get going: you may need to alter it to
have it perform to your specs. You can specify a folder location with
the NewPath variable; when you run this, the file is saved using the
value of cell A1 as filename. Let us know if we can provide additional
help:

Sub SaveAs()
Dim NewPath As String
Dim NewFileName As String

NewPath = quot;c:\quot;

NewFileName = Range(quot;a1quot;).Value

ActiveWorkbook.SaveAs Filename:=NewPath amp; NewFileName, _
FileFormat:=xlNormal, Password:=quot;quot;, WriteResPassword:=quot;quot;, _
ReadOnlyRecommended:=False, CreateBackup:=False

End Sub
Hi Thank you for the fast reply.

I have found out another way to do this which is this:

Sub SaveName()

ActiveSheet.Range(quot;B4quot;).Select
FileName = quot;H:\E5\Test\quot; amp; ActiveCell amp; quot;.xlsquot;
ActiveWorkbook.SaveAs FileName:=FileName
End Sub

I prefer your way though as it looks a little bit more structured.

Thank you so much for your help !!!!--
mabbutt
------------------------------------------------------------------------
mabbutt's Profile: www.excelforum.com/member.php...oamp;userid=34294
View this thread: www.excelforum.com/showthread...hreadid=541058

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()