Excel VBA - saving prob-filename=cell reference how to?

  • Thread starter Thread starter madmatt
  • Start date Start date
M

madmatt

how can i save a workbook with a file name which is in my work cell re
a1?

ie i want to save the workbook and i want the filename to be what is i
cel a1

whats the code to do it in a macro?
many thanks
mat
 
Hi
Try

sub save_with_cell()
Dim fname
fname = worksheets("sheet1").range("A1").value
fname = fname & ".xls"
ActiveWorkbook.SaveAs Filename:=fname
end sub

You should add some error checking to this (does the files already
exist, etc.)
 

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