View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default Reference sheets named by DAY

Hi Howard,

Am Tue, 20 Jan 2015 04:27:18 -0800 (PST) schrieb L. Howard:

CStr and Date

The Date type always contains both date and time information. For purposes of type conversion, Visual Basic considers 1/1/0001 (January 1 of the year 1) to be a neutral value for the date, and 00:00:00 (midnight) to be a neutral value for the time. CStr does not include neutral values in the resulting string. For example, if you convert #January 1, 0001 9:30:00# to a string, the result is "9:30:00 AM"; the date information is suppressed. However, the date information is still present in the original Date value and can be recovered with functions such as DatePart.


Dim myDate As Date

myDate = #1/1/2001 9:30:00 AM#

MsgBox CStr(myDate)

The result is: "01.01.2001 09:30:00"


Dim myDate As Double

myDate = #1/1/2001 9:30:00 AM#

MsgBox CStr(myDate)

The result is:"36892.3958333333


Dim myDate As Double

myDate = #1/1/2001 9:30:00 AM#

MsgBox CStr(Day(myDate))

The result = "1" as well with dimension date and double


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional