Save file as filename plus fieldname

A

annep

I wrote this complicated spreadsheet with macros with 5 sheets. I am not
good at macro writing, but the wizard helps. On open I unprotect the
fields the user has to fill in. The user manages periodically to mess
up my formulas, because he keeps saving my original file with data. I
don't know how he does it, but he does.

The spreadsheet is called Joist
I now searched and found that I can password protect the spreadsheet
and make it open in read only mode. It works fine, the user can still
enter data upon trying to save the spreadsheet excel prompts for file
name as: copy of_Joist.

Is it possible to write some code to make the filename a cell from the
spreadsheet, in this case Input!C2 has the pour number, for example
2458, I would like to save the spreadsheet as Joist2458.
 
G

Guest

Hi there,
You could try this code

Sub Macro1()

Dim fileext As String
Range("C2").Select
fileext = ActiveCell

ActiveWorkbook.SaveAs Filename:= _
"C:\Joist" & fileext & ".xls", FileFormat:= _
xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False _
, CreateBackup:=False
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top