Thread: Get the Date
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_7_] Bob Phillips[_7_] is offline
external usenet poster
 
Posts: 1,120
Default Get the Date

Thomas,

Here is some code

Dim iPos1 As Long
Dim iPos2 As Long
Dim iPos3 As Long
Dim iPos4 As Long

With Range("A1")
iPos1 = InStr(1, .Value, " ")
If iPos1 0 Then
iPos2 = InStr(iPos1 + 1, .Value, " ")
If iPos2 0 Then
iPos3 = InStr(iPos2 + 1, .Value, " ")
If iPos3 0 Then
iPos4 = InStr(iPos3 + 1, .Value, " ")
If iPos4 < 1 Then
iPos4 = Len(.Value) + 1
End If
MsgBox CDate(Replace(Mid(.Value, iPos1 + 1, iPos2 - 1 -
iPos1), ".", "/"))
MsgBox CDate(Replace(Mid(.Value, iPos3 + 1, iPos4 - 1 -
iPos1), ".", "/"))
End If
End If
End If
End With


--
HTH

Bob Phillips

"Thomas" wrote in message
...
Thank you a lot, but i have to do this via VBA.

Thomas

"galimi" wrote:

Put the following formula in B1

=MID(A1,FIND(" ",A1,1)+1,FIND(" ",A1,(FIND(" ",A1,1)+1))-FIND(" ",A1,1))

and the subsequent formula in C1

=MID(A1,FIND(B1,A1,1)+LEN(B1)+2,LEN(A1)-FIND(B1,A1,1)+LEN(B1)+2)

It makes assumptions that cell A1 conistently follows the format you
indicated below.
--
http://HelpExcel.com
1-888-INGENIO
1-888-464-3646
x0197758


"Thomas" wrote:

I need to know, how to read out the dates from the Line

A1: Report 01.06.2005 - 30.06.2005

Thanks