Save file with data from cells in worksheet as filename

Kevin Mac

New Member
Joined
Feb 21, 2002
Messages
8
I am looking for a solution that will save a file with data from within the spreadsheet when a user selects "file", "save". I want it to take data from "a1,b1,c1" and save the file with the filename such as "username - date - score" like (mccolk - 022302 - 95) and save it to a specified folder (g:coaching databasemccolk - 022302 -95.xls). If anyone has any suggestions or examples, it would be greatly appreciated. Thanks in advance
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Kevin

Try modifying this for your needs:

sub saveme()
ActiveWorkbook.SaveAs Filename:="C:Documents and SettingsdefaultMy Documentsscores " & _
' Format(Sheets("Store Info").Range("d4"), "0 ") & _
' Format(Sheets("Store Info").Range("h2"), _
' "yy.mmdd") & ".xls"
end sub

The above will save a file in the name of Scores+"D4"+"H2(in date format)" in my documents

HTH

Dan.
 
Upvote 0
Here's a solution that will work with the save button on the toolbar and from File > Save on the menu bar.

Dim btnSave1 As CommandBarButton
Dim btnSave2 As CommandBarButton

Sub Auto_Open()
Set btnSave1 = CommandBars("Standard").Controls("Save")
Set btnSave2 = CommandBars("File").Controls("Save")
With btnSave1
.Visible = True
.OnAction = "CustomSave"
End With
With btnSave2
.OnAction = "CustomSave"
End With
End Sub
Sub CustomSave()
Dim SaveName As String
Dim Dir As String
MsgBox "hi"
Application.DisplayAlerts = False
Dir = "C:My Documents"
SaveName = Cells(1, 1) & "-" & Cells(1, 2) & "-" & Cells(1, 3)
SaveName = Dir & SaveName
ActiveWorkbook.SaveAs Filename:=SaveName
End Sub
Sub Auto_Close()
CommandBars("Standard").Controls("Save").Reset
CommandBars("File").Controls("Save").Reset
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,375
Messages
6,119,168
Members
448,870
Latest member
max_pedreira

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top