saving a workbook

  • Thread starter Thread starter Dave
  • Start date Start date
D

Dave

I have a small problem and don't know if what I am trying
to do is possible? I want to save a spreadsheet giving it
a name which is entered into a cell within the sheet. I
can do this manually by copying the contents of the cell
and then pasting them into the file name box after
selecting the 'save as' option. However, I need to
simplyfy this for a non-excel literate colleague, so I
want to record a macro to perform the whole process, when
I record the macro and then run it, it simply reverts the
cell in question back to it's original content and then
tries to overwrite the previously saved file. e.g. cell c1
= "smith" - overwrite to "brown" use macro to save as -
cell c1 reverts to "smith" and tries to overwrite itself.
Is there any way around this problem?
Thanks
Dave
 
Hi
try the following (using cell A1 from sheet 1)
sub save_it()
dim wks as worksheet
dim fname
Dim path

set wks = worksheets("sheet1")
path = "C:\Temp\"
fname=CStr(wks.Range("A1").value)

ActiveWorkbook.SaveAs Filename:=path & fName
end sub
 
That's it - it works now! Thanks for the help.

Vielen Dank fuer die schnelle Hilfe.
 

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

Similar Threads


Back
Top