auto insert and name new sheet

  • Thread starter Thread starter laneman
  • Start date Start date
L

laneman

I want to tell a macro to create a new sheet and name it. The shee
names are serial numbers in sequence. So if the active sheet is name
1045, I want the macro to insert a new sheet and call it 1046. If thi
is possible, I would also like the macro to update the heading of th
new sheet to show the new serial number as well
 
Something like:

Dim ws As Worksheet
On Error Resume Next
Set ws = Worksheets.Add(After:=Worksheets(Worksheets.Count))
ws.Name = CStr(CInt(Worksheets(Worksheets.Count - 1).Name) + 1)
ws.Range("A1") = ws.Name
On Error GoTo 0
 
Back
Top