#1   Report Post  
Posted to microsoft.public.excel.misc
mabbutt
 
Posts: n/a
Default Saving with Macro


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: http://www.excelforum.com/member.php...o&userid=34294
View this thread: http://www.excelforum.com/showthread...hreadid=541058

  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave O
 
Posts: n/a
Default Saving with Macro

Here'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 = "c:\"

NewFileName = Range("a1").Value

ActiveWorkbook.SaveAs Filename:=NewPath & NewFileName, _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False

End Sub

  #3   Report Post  
Posted to microsoft.public.excel.misc
mabbutt
 
Posts: n/a
Default Saving with Macro


Hi Thank you for the fast reply.

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

Sub SaveName()

ActiveSheet.Range("B4").Select
FileName = "H:\E5\Test\" & ActiveCell & ".xls"
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: http://www.excelforum.com/member.php...o&userid=34294
View this thread: http://www.excelforum.com/showthread...hreadid=541058

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Editing a simple macro Connie Martin Excel Worksheet Functions 5 November 29th 05 09:19 PM
Renaming and saving workbooks but macro still deletes shrek Excel Worksheet Functions 0 November 8th 05 05:43 PM
macro with F9 Kenny Excel Discussion (Misc queries) 1 August 3rd 05 02:41 PM
Make Alignment options under format cells available as shortcut dforrest Excel Discussion (Misc queries) 1 July 14th 05 10:58 PM
Playing a macro from another workbook Jim Excel Discussion (Misc queries) 1 February 23rd 05 10:12 PM


All times are GMT +1. The time now is 05:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"