View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] johnkrehlik@gmail.com is offline
external usenet poster
 
Posts: 1
Default 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?