Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Excel Stored Dates

I have a UserForm that asks the user to select the year, the month, and the
day.
How do I convert this to an Excel Stored Date without having to write it to
a cell then extract the cell's value via .Formula?
Thanks,
--
Trent Argante
[DC.J(510)]
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default Excel Stored Dates

Guessing at what you seek, use CLng.

In Immediate Window:
?CLng(#4/20/2007#)
39192

Hth,
Merjet



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Excel Stored Dates

Take a look at the DateSerial method in XL/VBA Help.

In article ,
Trent Argante wrote:

I have a UserForm that asks the user to select the year, the month, and the
day.
How do I convert this to an Excel Stored Date without having to write it to
a cell then extract the cell's value via .Formula?
Thanks,

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Excel Stored Dates

Merjet,
You are using literals in CLng(#4/20/2007#).
But how do I use a variable? For Example, CLng(variable).
Thanks,
Trent Argante
[DC.J(510)]

*** Sent via Developersdex http://www.developersdex.com ***
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Excel Stored Dates

JE,

DateSerial seems only to return standard dates. But, I think I need the
5-digit number that Excel stores behind the scenes so that I can
compare/contrast dates from any country.

Thanks,

Trent Argante
[DC.J(510)]

*** Sent via Developersdex http://www.developersdex.com ***


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default Excel Stored Dates

Dim dt1 As Date
dt1 = Now
Debug.Print CLng(dt1)

The last line gives 39196 in the Immediate Window.

Hth,
Merjet


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
Convert dates stored as text Emece Excel Discussion (Misc queries) 2 May 22nd 10 06:37 AM
Need to combine dates stored in seperate columns mrcosna Excel Discussion (Misc queries) 4 November 3rd 08 04:02 PM
How do I convert dates stored as dates to text? diamunds Excel Discussion (Misc queries) 5 September 7th 07 05:38 PM
Converting numbers stored as dates to text in Excel David from Furdale Excel Discussion (Misc queries) 1 July 17th 06 06:34 PM
convert dates stored as text to dates lenko Excel Programming 2 December 5th 04 06:30 PM


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

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"