LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Excel VBA - checking a date field for null

Hi,
I have a VBA function in excel that checks a date field to see if it is
null/ in past or in future.

The problem is even if the filed is blank the function returns info stating
it is in the past

Here is the function

Function CheckDate(dtTest as Date)

If Len(Trim(dtTest)) = 0 Then 'Tried IsNull - did not work
CheckDate = "BLANK"
ElseIf dtTest < Date Then
CheckDate = "PAST"
Else
CheckDate = "Future"
End If

Is there a way to check if the date field is "empty'

TIA


 
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
I want to use a different cell if my date field is NULL/BLANK Ralph D''Andrea Excel Worksheet Functions 5 October 23rd 07 07:13 PM
How to Join/concatenate a date field with a time field in Excel? Alan Excel Discussion (Misc queries) 4 August 9th 05 10:07 PM
Checking that any cells are null RFJ Excel Worksheet Functions 5 June 21st 05 01:21 PM
Handling Null Field in Macro Loop Ken Excel Programming 2 October 19th 04 10:17 PM
Null Field Result in Loop Ken Excel Programming 2 October 19th 04 10:07 PM


All times are GMT +1. The time now is 11:56 PM.

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

About Us

"It's about Microsoft Excel"