MrExcel Publishing
Your One Stop for Excel Tips & Solutions

VB macro to name a worksheet by the conntents of a cell


Posted by Marg on October 21, 2000 12:10 AM

How do I create a macro that will save a worksheet
named by the contents of a "specific cell"
I have a from that needs to be saved each time it is filled out by a new file name.


Posted by Ivan Moala on October 23, 2000 12:44 AM


Marg
A few more details and someone will be able to
supply a better answer....but a quick untested
macro......(NO Error handling !!)

Sub SaveSheet()
'Saves sheet2 as a file named from Activesheet
'Cell A1
Dim Fn As String

Fn = Activesheet.Range("A1").Text
Sheets("Sheet2").Copy 'Sheets2 is copied !
ActiveWorkbook.SaveAs FileName:= Fn
ActiveWindow.Close
End Sub


Ivan

Posted by Rich White on October 27, 2000 11:10 AM

Ivan

I'm not the original poster but THANK YOU!!!!!

Rich