![]() |
Insert Sheet
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 |
Insert Sheet
Worksheets.Add.Name = "Bob" -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) 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 |
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 |
All times are GMT +1. The time now is 10:23 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com