+ Reply to Thread
Results 1 to 4 of 4

extract hidden date

  1. #1
    Sunil Patel
    Guest

    extract hidden date

    I have date in range a1 to a2000
    On only one line there will be a date. Is there a simplecommand that can find this date. At present i am using the following code.


    Set CHECKRANGE = Columns(1).Cells
    For Each CELL In CHECKRANGE
    If CELL.Text Like "*##/##/20##*" Then
    ........
    .........
    NEXT CELL

    an example of the date in column is " 146.01 153.80 n/a 0.06 -1.85 ( -1.3%) n/a 03/03/2006 0 £0.00 £0.00 n/a "
    i need to find and extract that date.


    Thanks

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,486

    Smile

    you can use vlookup
    If that doesn't work check out data, filter
    I am not sure what you are doing with this date, are you just looking to see if its there, or are you going to extract data from the column beside it

  3. #3
    Toppers
    Guest

    RE: extract hidden date

    A slight modification of your code:

    Dim v As Variant
    Set CHECKRANGE = Range("A1:A" & Cells(Rows.Count, "A").End(xlUp).Row)
    For Each cell In CHECKRANGE
    v = Split(cell.Text, " ")
    For i = LBound(v) To UBound(v)
    If v(i) Like "*##/##/20##*" Then
    MsgBox v(i)
    GoTo Nextaction:
    End If
    Next i
    Next cell
    Nextaction:

    HTH

    "Sunil Patel" wrote:

    > I have date in range a1 to a2000
    > On only one line there will be a date. Is there a simplecommand that can find this date. At present i am using the following code.
    >
    >
    > Set CHECKRANGE = Columns(1).Cells
    > For Each CELL In CHECKRANGE
    > If CELL.Text Like "*##/##/20##*" Then
    > ........
    > .........
    > NEXT CELL
    >
    > an example of the date in column is " 146.01 153.80 n/a 0.06 -1.85 ( -1.3%) n/a 03/03/2006 0 £0.00 £0.00 n/a "
    > i need to find and extract that date.
    >
    >
    > Thanks


  4. #4
    JE McGimpsey
    Guest

    Re: extract hidden date

    One way:

    Dim rCell As Range
    Dim sExtract As String
    For Each rCell In Range("A1:A" & _
    Range("A" & Rows.Count).End(xlUp).Row)
    With rCell
    If .Text Like "*##/##/20##*" Then
    sExtract = Mid(.Text, InStr(.Text, "/20") - 5, 10)
    MsgBox .Address(False, False) & ": " & sExtract
    End If
    End With
    Next rCell

    Note: this is based on your example. If you had data like:

    146.01 153.80 n/a 0.06 1/20 (-1.3%) n/a 03/03/2006 0 ...

    this would need more sophisticated pattern matching


    In article <[email protected]>,
    "Sunil Patel" <[email protected]> wrote:

    > I have date in range a1 to a2000
    > On only one line there will be a date. Is there a simplecommand that can find
    > this date. At present i am using the following code.
    >
    >
    > Set CHECKRANGE = Columns(1).Cells
    > For Each CELL In CHECKRANGE
    > If CELL.Text Like "*##/##/20##*" Then
    > .......
    > ........
    > NEXT CELL
    >
    > an example of the date in column is " 146.01 153.80 n/a 0.06 -1.85 (
    > -1.3%) n/a 03/03/2006 0 £0.00 £0.00 n/a "
    > i need to find and extract that date.
    >
    >
    > Thanks


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1