Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004
    Posts
    18

    Unanswered: help with automation macro ..

    i know nuts about macros and i need some help in here.

    ive to paste the following data into the excel file.

    Return-Path:
    <owner-extdom.svo-jpn@sj-core-3.cisco.com>
    Received:
    from gateway1a.dhl.com ([199.41.248.137]) by saturn.sin-ro.dhl.com (Netscape Messaging Server 3.6) with ESMTP id
    AAA41CC for <gcs.sg.jpnlsc@dhl.com>; Wed, 11 Aug 2004 17:33:30 +0800



    and ive to retrieve the DATE out from it, which is the "11 Aug 2004 17:33:30". i know i need to use the split function and split the sentence up and put them into an array or something like that. and after that i have to use the join function to join the subarrays which contains the dates.

    could anyone give me a headstart or soemthing? cause ive really got no idea on how to go about doing it ...

    many many thanks in advance ..

  2. #2
    Join Date
    Jan 2004
    Location
    Aberdeen, Scotland
    Posts
    1,067
    here's a start for you,
    All ive done is split up the strings and store them to an array and if it's a date store it in a seperate array and then ouputs the dates to column B

    Code:
    Sub test()
    Dim MyText As String
    Dim MyTextArray As Variant
    Dim OutputArray(10000) As Variant
    Dim I As Integer, J As Integer
    
        J = 0
        For K = 1 To Range("A" & Rows.Count).End(xlUp).Row
        
        
            MyText = Range("A" & K).Formula
            MyTextArray = Split(MyText)
            For I = LBound(MyTextArray) To UBound(MyTextArray)
                On Error Resume Next
                OutputArray(J) = CDate(MyTextArray(I))
                If Err.Number = 0 Then
                    J = J + 1
                End If
            Next I
            
            On Error GoTo 0
            For I = 0 To J
                If Not OutputArray(I) = "" Then
                    Range("B" & I + 1).Formula = OutputArray(I)
                End If
            Next I
        Next K
            
    End Sub
    hope this helps a little

    Dave

  3. #3
    Join Date
    Mar 2004
    Posts
    18

    :)

    yeah .. thanks dude. everything's working now. thanks alot !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •