View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default find text similar to yyyy-mm-dd in string

Try some code like the following:

Dim S As String
Dim N As Long
S = "asdf2006-12-05asdf" ' whatever
For N = 1 To Len(S) - 10
If Mid(S, N, 10) Like "####-##-##" Then
Debug.Print Mid(S, N, 10)
Exit Sub
End If
Next N



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


wrote in message
oups.com...
I'd like to find the location of each date within a very long
string
(loaded to string from text file). The format of the dates is
yyyy-mm-dd. It would be great if I could use "InStr" and
"Like"
together somehow, but I don't know how. Any ideas? Thanks.