#1   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default date function

I am trying to make a function that will search a range of dates (the
first argument) and if it matches the date in the second argument will
return true. I keep getting #VALUE errors with the second argument.
I'm a bit stuck. I'd appreciate any help I can get.


Function MatchDate(TPRrange As range, TPRDate As range) As Boolean
Application.Volatile (True)
Dim c
For Each c In ActiveWorkbook.range(TPRrange)
If c.Value = range(TPRDate) Then MatchDate = True
Exit For
Next
MatchDate = False
End Function


Function MatchDate2(TPRrange As range, TPRDate As Date) As Boolean
Application.Volatile (True)
Dim Index As Variant

' Find a match for the serial value of the date in the range A1:A10
' on Sheet1.
Index = Application.Match(CLng(TPRDate), range(TPRrange), 0)

' Display the results.
If IsError(Index) Then
MatchDate2 = True
Else
MatchDate2 = False
End If
End Function


Thanks,
G

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 function in Excel that updates only when a doc is changed? torino0020 Excel Worksheet Functions 1 January 5th 06 03:00 AM
Date Function Khangura Excel Discussion (Misc queries) 1 December 21st 05 09:33 AM
date format and the RIGHT function Rich Hayes Excel Worksheet Functions 0 December 19th 05 11:06 AM
Date function Dee Excel Worksheet Functions 2 July 13th 05 03:32 PM
Is there a function to show future date taxmom Excel Worksheet Functions 2 March 4th 05 09:23 PM


All times are GMT +1. The time now is 10:15 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"