Macro for naming sheets?

O

Olle Svensson

I've just created a macro assigned to a button that creates a copy of a
sheet. Now, I would like to add a line or two of code in that macro that
changes the name of the newly created sheet to what is written in a cell on a
different sheet.

Is this in any way possible?
 
R

Ron de Bruin

Try this

Sub test()
ActiveSheet.Copy after:=Sheets(Sheets.Count)
On Error Resume Next
ActiveSheet.Name = Sheets("Sheet1").Range("A1").Value
On Error GoTo 0
End Sub
 
Top