Get a value from cell D3 and use that value as a new filename


Posted by Moe on March 10, 2001 2:47 PM

I am currently using Microsoft Excel 97 SR-2 and running
Windows 95. Is there a way that I can create an Excel
macro that will get a value from cell D3 and use that value
as a new filename? Possibly in a VB module?



Posted by Ian on March 14, 2001 6:46 PM

Hi Moe
What's below worked for me but I'm not a VBA whiz by any means(i recorded this macro to start with and then played with it) and don't know if it will work if you have already saved the file -can't see why not though. Also note that this macro will not create a backup file so if you want one, change this bit of the code to CreateBackup:=True . All other settings are default for Excel as far as I know.
Cheers
Ian

Sub SaveAsActiveCell()
Range("D3").Select
ActiveWorkbook.SaveAs FileName:=ActiveCell, FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
End Sub