ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Create new worksheet (https://www.excelbanter.com/excel-programming/373213-create-new-worksheet.html)

Arne Hegefors

Create new worksheet
 
Hello! I have a macro that when I press a button I want it to create a new
worksheet. The name of the worksheet shall be the current date. I do not know
exactly how to write this so I would really appreciate some help. Pls help me
with this code! Thank you very much!

Norman Jones

Create new worksheet
 
Hi Anne,

Try:

'=============
Public Sub Tester()
Dim SH As Worksheet

Set SH = Worksheets.Add(After:=Sheets(Sheets.Count))
SH.Name = Format(Date, "dd-mm-yy")
End Sub
'<<=============

---
Regards,
Norman


"Arne Hegefors" wrote in message
...
Hello! I have a macro that when I press a button I want it to create a new
worksheet. The name of the worksheet shall be the current date. I do not
know
exactly how to write this so I would really appreciate some help. Pls help
me
with this code! Thank you very much!




Bob Phillips

Create new worksheet
 
Worksheets.Add(After:=Worksheets(Worksheets.Count) ).Name = Format(Date,
"dd-mm-yy")


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Arne Hegefors" wrote in message
...
Hello! I have a macro that when I press a button I want it to create a new
worksheet. The name of the worksheet shall be the current date. I do not

know
exactly how to write this so I would really appreciate some help. Pls help

me
with this code! Thank you very much!





All times are GMT +1. The time now is 11:21 AM.

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