PC Review


Reply
Thread Tools Rate Thread

Create new worksheet name with System DateTime

 
 
magix
Guest
Posts: n/a
 
      11th Dec 2005
Hi,

in Excel VBA coding,
How can I create new worksheet name with System DateTime ? Because I
understand the name can not have some special character like colon :

E.g Let say now is Dec 11, 2005 1:30:29 pm. It needs to put into string
format

So it will be 12112005133029

Something like:

Dim MyDate as String
Dim MyTime as String
MyTime = Time
MyDate = Date

..... after formating
wsNew.Name = MyDate & MyTime

Please help. Thanks.

Regards, Magix


 
Reply With Quote
 
 
 
 
JE McGimpsey
Guest
Posts: n/a
 
      11th Dec 2005
One way:

wsNew.Name = Format(Now,"mmddyyyyhhmmss")


In article <439b924d$(E-Mail Removed)>, "magix" <(E-Mail Removed)>
wrote:

> Hi,
>
> in Excel VBA coding,
> How can I create new worksheet name with System DateTime ? Because I
> understand the name can not have some special character like colon :
>
> E.g Let say now is Dec 11, 2005 1:30:29 pm. It needs to put into string
> format
>
> So it will be 12112005133029
>
> Something like:
>
> Dim MyDate as String
> Dim MyTime as String
> MyTime = Time
> MyDate = Date
>
> .... after formating
> wsNew.Name = MyDate & MyTime
>
> Please help. Thanks.
>
> Regards, Magix

 
Reply With Quote
 
Earl Kiosterud
Guest
Posts: n/a
 
      11th Dec 2005
Magix,

MyDate = Format(Date, "mmddyyyy")
MyTime = Format(Time, "hhmmss")

Or you could use dashes for readability:

MyDate = Format(Date, "mm-dd-yyyy")
MyTime = Format(Time, "hh-mm-ss")

Earl Kiosterud
www.smokeylake.com

"magix" <(E-Mail Removed)> wrote in message
news:439b924d$(E-Mail Removed)...
> Hi,
>
> in Excel VBA coding,
> How can I create new worksheet name with System DateTime ? Because I
> understand the name can not have some special character like colon :
>
> E.g Let say now is Dec 11, 2005 1:30:29 pm. It needs to put into string
> format
>
> So it will be 12112005133029
>
> Something like:
>
> Dim MyDate as String
> Dim MyTime as String
> MyTime = Time
> MyDate = Date
>
> .... after formating
> wsNew.Name = MyDate & MyTime
>
> Please help. Thanks.
>
> Regards, Magix
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
System.DateTime doesn't convert to SqlDbType.DateTime Narshe Microsoft C# .NET 3 2nd Nov 2005 05:42 PM
Operator '=' on System.DateTime and System.Double googlegroups@kirklarsen.com Microsoft ADO .NET 15 23rd Jun 2005 04:30 PM
Cannot perform '>=' operation on System.DateTime and System.String Ieuan Microsoft ADO .NET 3 4th Oct 2004 03:43 PM
DateTime problem: how to create datetime format hh:mm:ss AM/PM without the date mimi Microsoft C# .NET 1 6th Aug 2004 08:28 PM
Convert datetime to System.DateTime Martin Schmid Microsoft ADO .NET 1 24th Feb 2004 08:52 PM


Features
 

Advertising
 

Newsgroups
 


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