Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to find a date within a row of dates. The dates are actually
calculations(a series), formatted to read as dates. The other rub here is that becasue of the calculation the day of the month is varied since the original creator of the spreadsheet adds 32 to the previous date. (Oh by the way the date is formatted for Canada and not the USA which means the month and day are reversed) So can I use * or must I use a function to convert the date calculations beofre I do a Find I typically use: ColRef2 = xlApp.Rows(5).Find("1/1/2005").Column But it is not working since the day value is not "1" but rather a number other than "1". SO I tried the following without any success ColRef2 = xlApp.Rows(5).Find("1/*/2005").Column |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try as UDF:
1. you'll need to call IsWithin with the value in each cell 2. see the comments in IsWithin 3. your wildcard is BOTH the day of the month & the month of the year 4. this is for the UK: adapt for other regional settings Function IsWithin(ByVal mydate As Date, ByVal myyear As Integer) As Boolean Select Case Sgn((DateValue(("01/01/" & myyear)) - mydate)) + Sgn((DateValue(("31/12/" & myyear)) - mydate)) Case -2 IsWithin = False 'exceeds maximum Case -1 IsWithin = True 'equals maximum Case 0 IsWithin = True 'within minimum & maximum Case 1 IsWithin = True 'equals minimum Case 2 IsWithin = False ' below mimimum End Select End Function Sub aa() MsgBox IsWithin("01/03/2004", 2004) End Sub "Jenny" wrote: I am trying to find a date within a row of dates. The dates are actually calculations(a series), formatted to read as dates. The other rub here is that becasue of the calculation the day of the month is varied since the original creator of the spreadsheet adds 32 to the previous date. (Oh by the way the date is formatted for Canada and not the USA which means the month and day are reversed) So can I use * or must I use a function to convert the date calculations beofre I do a Find I typically use: ColRef2 = xlApp.Rows(5).Find("1/1/2005").Column But it is not working since the day value is not "1" but rather a number other than "1". SO I tried the following without any success ColRef2 = xlApp.Rows(5).Find("1/*/2005").Column |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Wildcard for finding items that start with ? | Excel Discussion (Misc queries) | |||
Finding a Date 90 days previous to present date | Excel Worksheet Functions | |||
Wildcard for finding the first numeric digit in a cell? | Excel Worksheet Functions | |||
finding a date/time in a list that is closest to an existing date/ | Excel Discussion (Misc queries) | |||
Finding the Monday date based on a different date in same week | Excel Worksheet Functions |