Insert Sheet

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

What is the code to insert a sheet and name it when it is
insert. This is what I have, but it won't work if there
already is a sheet4.

Sheets.Add
Sheets("Sheet4").Select
Sheets("Sheet4").Name = "Worksheet"

Thank you
 
Worksheets.Add.Name = "Bob"

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Try this

Sub test()
On Error Resume Next
Sheets.Add.Name = "Worksheet"
If Err.Number > 0 Then
MsgBox "Change the name of : " & ActiveSheet.Name & " manually"
Err.Clear
End If
On Error GoTo 0
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top