Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
pattern matchimg in VBA Excel using LIKE operator
I have cells containing a series of dates in the format: 8/21/2006 or
11/6/2005 or 11/23/2005 or 8/7/2006. I want to identify these cells by the pattern in a VBA module. I have tried these listed below and variations without success: Function IsDate(xDate As String) As Boolean If xDate Like "*/*/*" Then IsDate = True Else IsDate = False End If End Function Function IsDate(xDate As String) As Boolean If xDate Like "*/*/####" Then IsDate = True Else IsDate = False End If End Function Function IsDate(xDate As String) As Boolean If xDate Like "*[/]*[/]*" Then IsDate = True Else IsDate = False End If End Function I have also declared Option Compare Text and not declared Option Compare Text. Any ideas? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
pattern matchimg in VBA Excel using LIKE operator
Maybe:
Function MyIsDate(xDate as String) as Boolean MyIsDate = xDate like "##/##/####" or xDate like "#/##/####" _ or xDate like "##/#/####" End Function What about the built in IsDate function? -- Regards, Tom Ogilvy wrote in message oups.com... I have cells containing a series of dates in the format: 8/21/2006 or 11/6/2005 or 11/23/2005 or 8/7/2006. I want to identify these cells by the pattern in a VBA module. I have tried these listed below and variations without success: Function IsDate(xDate As String) As Boolean If xDate Like "*/*/*" Then IsDate = True Else IsDate = False End If End Function Function IsDate(xDate As String) As Boolean If xDate Like "*/*/####" Then IsDate = True Else IsDate = False End If End Function Function IsDate(xDate As String) As Boolean If xDate Like "*[/]*[/]*" Then IsDate = True Else IsDate = False End If End Function I have also declared Option Compare Text and not declared Option Compare Text. Any ideas? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Does Excel have an operator similar to LIKE? | Excel Discussion (Misc queries) | |||
XOR operator in Excel | Excel Discussion (Misc queries) | |||
have Excel retrieve conditional operator ( < = ) from a cell | Excel Worksheet Functions | |||
MAJOR BUG: Excel operator precedence is wrong | Excel Worksheet Functions | |||
Difference operator in Excel VBA | Excel Programming |