Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() 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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Editing a simple macro | Excel Worksheet Functions | |||
Renaming and saving workbooks but macro still deletes | Excel Worksheet Functions | |||
macro with F9 | Excel Discussion (Misc queries) | |||
Make Alignment options under format cells available as shortcut | Excel Discussion (Misc queries) | |||
Playing a macro from another workbook | Excel Discussion (Misc queries) |