• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

From String i want last date

Abhijeet

Active Member
Hi
I have data in excel from string i want to pull last date.
Please tell me.Expected dates i mention in attach file in Column B
 

Attachments

  • Dates.xlsx
    9.5 KB · Views: 5

Hi,

try this !​

Code:
Sub Demo()
    With Sheet1.Cells(1).CurrentRegion.Rows
        ReDim ED(2 To .Count, 0)

        For R& = 2 To .Count
                          SP = Split(.Cells(R, 1).Value, "-")
                If IsDate(SP(UBound(SP))) Then ED(R, 0) = CDate(SP(UBound(SP))) Else _
            If IsDate(.Cells(R, 1).Value) Then ED(R, 0) = CDate(.Cells(R, 1).Value)
        Next

        With .Cells(2, 2).Resize(.Count - 1)
            .NumberFormat = "dd/mmm/yy ":  .Value = ED
        End With
    End With
End Sub

Do you like it ? So thanks to click on bottom right Like !
 
Thanks Mark L For this macro Please tell me I want Date format US 14-Mar-12 what should be change in Code
 

My code is based upon your attached workbook expected dates column !

$-409 is the US format LCID ! I have nothing else
or as usual you must write a true explanation …

You just have to amend the format !​
 
Last edited:
Back
Top