Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Have the following function to change an integer number in the form of
yyyymmdd to a date. The return value has to be declared as a date. Function ConvertDates(ByVal intDate As Long) As Date 'to return a date seems to be the only way to 'guarantee that the day and month are not reversed 'the problem is that null values will be converted 'to 12:00:00 AM, this can be dealt with by either 'changing to "" after or 'do ActiveWindow.DisplayZeros = False '------------------------------------------------------------ If intDate = 0 Or intDate = Null Then Exit Function Else ConvertDates = Right(intDate, 2) & "/" & _ Mid(intDate, 5, 2) & "/" & _ Left(intDate, 4) End If End Function The problem arises when the variable intDate is a NULL value or EMPTY. In that case the value that eventually appears in the sheet will be 12:00:00 AM Now is there any way to avoid this other than changing the value afterwards to "" or doing ActiveWindow.DisplayZeros = False? Both these methods have their drawbacks and I would like to handle this in the function. Thanks for any advice. RBS |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Returning Data to an empty Cell | Excel Worksheet Functions | |||
Can IF function return an empty cell? (not "") | Excel Worksheet Functions | |||
Date Function formula that will return the date of a specific week | Excel Worksheet Functions | |||
Fix InputBox - Returning Empty String | Excel Programming | |||
VBA function returning the value EMPTY | Excel Programming |