ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Creat a new worksheet (https://www.excelbanter.com/excel-discussion-misc-queries/23425-creat-new-worksheet.html)

lashio

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



William

Hi lashio

ActiveWorkbook.Sheets.Add.Name = "New"

--

XL2003
Regards

William



"lashio" wrote in message
...
Please help me to write a VBA code to creat a new worksheet named "New"
Thanks




Hank Scorpio

On Mon, 25 Apr 2005 02:07:32 GMT, "lashio"
wrote:

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


---------------------------------------------------------
Hank Scorpio
scorpionet who hates spam is at iprimus.com.au (You know what to do.)
* Please keep all replies in this Newsgroup. Thanks! *

lashio

Thank you, Hank

"Hank Scorpio" wrote in message
...
On Mon, 25 Apr 2005 02:07:32 GMT, "lashio"
wrote:

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


---------------------------------------------------------
Hank Scorpio
scorpionet who hates spam is at iprimus.com.au (You know what to do.)
* Please keep all replies in this Newsgroup. Thanks! *




lashio

Thank you, William

"William" wrote in message
...
Hi lashio

ActiveWorkbook.Sheets.Add.Name = "New"

--

XL2003
Regards

William



"lashio" wrote in message
...
Please help me to write a VBA code to creat a new worksheet named "New"
Thanks







All times are GMT +1. The time now is 12:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com