Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default Convert date like string to serial number

Hi All

Here is a simple question:

How can I turn a date-like string (e.g. "01/01/07") to its date
serial number equivalent (39083) using VB?

I can do this easily in Excel itself (using the VALULE formulae or
changing the cell type) but am struggling to do this in VB.

Thanks in advance for any ideas.

Chris

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Convert date like string to serial number

one way:

Dim nSerial As Long
nSerial = CLng(DateValue("01/01/07"))

In article . com,
"Chrisso" wrote:

Hi All

Here is a simple question:

How can I turn a date-like string (e.g. "01/01/07") to its date
serial number equivalent (39083) using VB?

I can do this easily in Excel itself (using the VALULE formulae or
changing the cell type) but am struggling to do this in VB.

Thanks in advance for any ideas.

Chris

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default Convert date like string to serial number

Thanks JE - just what I needed.

Strange that there is not a built in function to do this although its
implementation would probably be the one you provided. It would make
the code more readable.

Chris

JE McGimpsey wrote:
one way:

Dim nSerial As Long
nSerial = CLng(DateValue("01/01/07"))

In article . com,
"Chrisso" wrote:

Hi All

Here is a simple question:

How can I turn a date-like string (e.g. "01/01/07") to its date
serial number equivalent (39083) using VB?

I can do this easily in Excel itself (using the VALULE formulae or
changing the cell type) but am struggling to do this in VB.

Thanks in advance for any ideas.

Chris


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
Date String To Serial goss[_2_] Excel Discussion (Misc queries) 11 November 9th 08 05:26 AM
convert serial number into date santhu Excel Discussion (Misc queries) 2 October 28th 06 10:27 AM
How do I convert Date serial number to date rdunne Excel Worksheet Functions 1 April 12th 05 03:04 PM
format cells with ### as number, then convert to string showing date. RB Smissaert Excel Programming 4 October 2nd 04 09:32 PM
Convert date to serial number in VBA Michael J. Malinsky Excel Programming 1 September 10th 03 08:43 PM


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

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

About Us

"It's about Microsoft Excel"