Thread: Insert Sheet
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Insert Sheet

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


--
Regards Ron de Bruin
http://www.rondebruin.nl


wrote in message ...
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