Save file using cell contents as file name

In this blog, I'll explain how to save the file with cell content as file name.

The Cell Value which is used for file name is A1 and the extension is ".xlsx".

1. Open a new file
2. Press Alt+F11 to open VBA editor
3. In the left navigation window select ThisWorkbook
4. In the editor window enter the code below
5. Close the VBA editor
6. Save the file as Macro Enabled File
7. Test with you inputs


Sub FileNameAsCellContent()

Dim FileName As String
Dim Path As String

Application.DisplayAlerts = False

Path = "C:\" 'Change the directory path here where you want to save the file
FileName = Range("A1").Value & ".xlsx" 'Change extension here

ActiveWorkbook.SaveAs Path & FileName, xlOpenXMLWorkbook 'Change the format here which matches with the extention above. Choose from the following link

Application.DisplayAlerts = True


End Sub

I think this has been informative and I thank you for viewing.


FileNameAsCellContent.xlsm11.91 KB


Thanks, this works perfectly.
Can you make it so it will save to a folder name specified in Cell A1 in C:\My folder\

eg. Cell A1 says "John Smith" so it will save to C:\My folder\John Smith\

Any help would be much appreciated.


Reply is getting blocked. Contact me on my email.


Cant post anything. Worst spam filter ever

What is your email?

What is your email?