+ Reply to Thread
Results 1 to 3 of 3

Create new worksheet name with System DateTime

  1. #1
    magix
    Guest

    Create new worksheet name with System DateTime

    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



  2. #2
    JE McGimpsey
    Guest

    Re: Create new worksheet name with System DateTime

    One way:

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


    In article <439b924d$1_1@news.tm.net.my>, "magix" <magix@asia.com>
    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


  3. #3
    Earl Kiosterud
    Guest

    Re: Create new worksheet name with System DateTime

    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" <magix@asia.com> wrote in message
    news:439b924d$1_1@news.tm.net.my...
    > 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1