+ Reply to Thread
Results 1 to 3 of 3

object is not supporting for date extraction from cell

  1. #1
    Registered User
    Join Date
    03-21-2009
    Location
    Bangalore
    MS-Off Ver
    Excel 2003
    Posts
    60

    object is not supporting for date extraction from cell

    Hi Friends,

    I want to extract date from the following series ( that I want to remove "_n1" and the date format would be (m/dd/yyyy). I wrote a procedure using worksheet function but range object is not supporting. Please let me know how to solve through procedure.



    Exp. No.
    07162009_n1
    07162009_n1
    07162009_n1
    07162009_n1
    07162009_n1
    07162009_n1
    07162009_n1
    07162009_n1
    07162009_n1
    07162009_n1
    07162009_n1
    09252009_n1
    07162009_n1
    07162009_n1
    07162009_n1
    07162009_n1
    09252009_n1
    07162009_n1
    07162009_n1
    07162009_n1
    07162009_n1

    Sub datedemo()
    Dim rng As Range
    Dim i As Integer
    Dim r As Integer
    Set rng = Range("a1:a22")
    r = 2
    For i = 1 To rng.Rows.Count

    rng.Cells(i).Offset(0, 1).Value = Application.WorksheetFunction.Date(Mid(rng.Cells(i), 5, 4), Left(rng.Cells(i), 2), Mid(rng.Cells(i), 3, 2))
    Next i
    End Sub

  2. #2
    Valued Forum Contributor Richard Schollar's Avatar
    Join Date
    05-23-2006
    Location
    Hampshire UK
    MS-Off Ver
    Excel 2002
    Posts
    1,264

    Re: object is not supporting for date extraction from cell

    Hi

    Use the VBA DateSerial function (takes arguments in the same order as the Excel DATE worksheet function:

    Please Login or Register  to view this content.
    Richard
    Richard Schollar
    Microsoft MVP - Excel

  3. #3
    Registered User
    Join Date
    03-21-2009
    Location
    Bangalore
    MS-Off Ver
    Excel 2003
    Posts
    60

    Re: object is not supporting for date extraction from cell

    Hi Richard,

    Thank you very much for replying my post.


    Coming to the my post. I am getting (Type Mismatch) run time error.


    I am using excel-2003, Is DateSerial function supports in excel 2003?



    Thanks & Regards
    Ramesh

+ 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