Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Give name of date on a new worksheet

Hello,
I want to create a new worksheet and give it the name of
the date
I use this code but I get error 1004

Worksheets.Add(After:=Worksheets(Worksheets.Count) ).Name
= DateValue(Now)

Can you please tell me what I am doing wrong.
I have checked help files and the internet I cant get
working

Thanks for you time.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Give name of date on a new worksheet

Use this Antonis

Worksheets.Add(After:=Worksheets(Worksheets.Count) ).Name _
= Format(Now, "dd-mm-yy h-mm-ss")

Change the format as you like


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Antonis" wrote in message ...
Hello,
I want to create a new worksheet and give it the name of
the date
I use this code but I get error 1004

Worksheets.Add(After:=Worksheets(Worksheets.Count) ).Name
= DateValue(Now)

Can you please tell me what I am doing wrong.
I have checked help files and the internet I cant get
working

Thanks for you time.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default Give name of date on a new worksheet

Try this instead of DateValue(Now) :-

Format(DateValue(Now), "YYMMDD")

You can alter the format to suit your needs

Geoff



"Antonis" wrote in message
...
Hello,
I want to create a new worksheet and give it the name of
the date
I use this code but I get error 1004

Worksheets.Add(After:=Worksheets(Worksheets.Count) ).Name
= DateValue(Now)

Can you please tell me what I am doing wrong.
I have checked help files and the internet I cant get
working

Thanks for you time.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Give name of date on a new worksheet

Thanks a lot.

I also found this way if it interests you.

Dim ShName As String
Dim nChr As Integer
ShName = CStr(Date)
' Replace /
For nChr = 1 To Len(ShName)
If Mid(ShName, nChr, 1) = "/" Then Mid(ShName,
nChr, 1) = "-"
Next
Worksheets.Add(After:=Worksheets(Worksheets.Count) ).Name
= ShName

It is an interesting approach

Thanks again
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Give name of date on a new worksheet

It is an interesting approach
if you like to use more code than you need <g

--
Regards,
Tom Ogilvy


Antonis wrote in message
...
Thanks a lot.

I also found this way if it interests you.

Dim ShName As String
Dim nChr As Integer
ShName = CStr(Date)
' Replace /
For nChr = 1 To Len(ShName)
If Mid(ShName, nChr, 1) = "/" Then Mid(ShName,
nChr, 1) = "-"
Next
Worksheets.Add(After:=Worksheets(Worksheets.Count) ).Name
= ShName

It is an interesting approach

Thanks again



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
formula to look at current date and markdown date to give price veena Excel Discussion (Misc queries) 4 November 13th 08 07:40 PM
can anyone give me all the functions in the excel worksheet with Neelakanta Excel Worksheet Functions 1 May 28th 08 11:35 AM
Formula to give date and time Angela1979 Excel Worksheet Functions 6 April 13th 07 02:36 AM
How to give access to certain cells in the protected worksheet ? fbagirov Excel Worksheet Functions 4 October 19th 06 12:42 AM
How do I give all access to one worksheet but not to other worksh. B Fraissinet Excel Worksheet Functions 1 January 12th 05 06:37 AM


All times are GMT +1. The time now is 02:51 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"