assign cell content as file name

P

paul.sternhagen

I am attempting to create a macro that will save a workbook with the
file name under which I save the workbook coming from the contents of
one of the cells in the workbook. Suppose that each time the workbook
was altered, a specific cell (A1 on Sheet1 for instance) contained the
desired file name for that workbook. It is my goal to create a macro
that automatically assigns said workbook a name based on the content of
that cell. Any help would be most appreciated.
 
D

Dave Peterson

Something like???

dim myFileName as string
myfilename = "C:\temp\" & thisworkbook.worksheets("sheet1").range("a1").value
thisworkbook.saveas filename:=myfilename


You may want to look at .SaveCopyAs in VBA's help, too.
 
Top