Creat a new worksheet

  • Thread starter Thread starter lashio
  • Start date Start date
L

lashio

Please help me to write a VBA code to creat a new worksheet named "New"
Thanks
 
Hi lashio

ActiveWorkbook.Sheets.Add.Name = "New"

--

XL2003
Regards

William
(e-mail address removed)
 
Please help me to write a VBA code to creat a new worksheet named "New"
Thanks

Sub CreateNewWks()

Dim wks As Worksheet

Set wks = ActiveWorkbook.Worksheets.Add

'WARNING!
'This will fail if there's already a sheet by that name.
wks.Name = "New"

Set wks = Nothing

End Sub
 
Thank you, Hank

Hank Scorpio said:
Sub CreateNewWks()

Dim wks As Worksheet

Set wks = ActiveWorkbook.Worksheets.Add

'WARNING!
'This will fail if there's already a sheet by that name.
wks.Name = "New"

Set wks = Nothing

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