Save As macro

  • Thread starter Thread starter Tha BeatMaker
  • Start date Start date
T

Tha BeatMaker

I want to open a template, fill in some info, and then run a macro t
save as a certain name.

For example, after I open the template, I will type in John Smith in A
and 6/7/05 in B1. I want to run a macro that will automatically sav
that template as "JS060705.xls".

How can I do that
 
Tha said:
I want to open a template, fill in some info, and then run a macro to
save as a certain name.

For example, after I open the template, I will type in John Smith in A1
and 6/7/05 in B1. I want to run a macro that will automatically save
that template as "JS060705.xls".

How can I do that?
Put a button on the template file. Assign the following macro to the
button:


Code:
--------------------
Sub Button1_Click()
Dim dt
Dim nm
nm = Range("A1").Value
nm = Left$(nm,1) & Mid$(nm,InStr(nm," ")+1,1)
dt = DateValue(Range("B1").Value)
dt = Format(dt,"MMDDYY")
Activeworkbook.SaveAs FileName: = nm & dt & ".xls"
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

Back
Top