+ Reply to Thread
Results 1 to 5 of 5

How to convert Date to double in VBA?

  1. #1
    Registered User
    Join Date
    07-30-2011
    Location
    Southampton
    MS-Off Ver
    Excel 2007
    Posts
    22

    How to convert Date to double in VBA?

    Hi I need to convert date "dd/mm/yy" to double in VBA.

    I cannot find anything about that on the forum

    Thanks
    Last edited by Whistlerek; 07-31-2011 at 05:53 AM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: How to convert Date to double in VBA?

    A date in excel appears as number formatted as a date. So assuming the ActiveCell contains a date,you could use
    Please Login or Register  to view this content.
    I would use a Long variable & CLng not CDbl
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    365
    Posts
    1,256

    Re: How to convert Date to double in VBA?

    If it's coming from a cell, you could also use the Value2 property
    Please Login or Register  to view this content.
    Hope that helps,

    Colin

    RAD Excel Blog

  4. #4
    Registered User
    Join Date
    07-30-2011
    Location
    Southampton
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: How to convert Date to double in VBA?

    Thanks, works great!

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: How to convert Date to double in VBA?

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ 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