Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Save as a value in a cell

Status
Not open for further replies.

newbie2002

Programmer
Aug 19, 2002
12
MY
Dear proffesinals,

How can i write a code that saves the spreadsheet as the value in a cell. F.e. cell a1=76748, then the spreadsheet must automatically save in a folder like 76748.xls.

Thanks in advance...
 
Activeworkbook.saveas Filename:= range("A1").text & ".xls"
should do the trick Rgds
~Geoff~
 
Thanks a lot xlbo it works fantastic. But how can i save the files into one folder like C:\my documents\excel\ or something. I must give the path automatically...
 
And where does this code (Activeworkbook.saveas Filename:= range("A1").text & ".xls") go?

Thanks.

Robert
 
If I create a Module
General Declarations

ActiveWorkbook.SaveAs Filename:=Range("A1").Text & ".xls"
Sub SaveAsFilename()

End Sub

When I try to "RUN" I get a compile error: Invalid outside proceedure with the "A1" highlighted.


Thanks.


Robert
 
the code has to be in the sub:

Sub SaveAsFilename()
ActiveWorkbook.SaveAs Filename:=worksheets("SheetnameHere").Range("A1").Text & ".xls"
End Sub

To answer the path question, use:
cDir "C:\my documents\excel\"
ActiveWorkbook.SaveAs Filename:=worksheets("SheetnameHere").Range("A1").Text & ".xls"
HTH Rgds
~Geoff~
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top