Hi
I have this macro Last date given from each cell data this macro works only if "-" this value then but i have , space then this not work. i Want if Year not mention then Today date i.e month is greater than today then give previous year. Please tell me how to do this
I have this macro Last date given from each cell data this macro works only if "-" this value then but i have , space then this not work. i Want if Year not mention then Today date i.e month is greater than today then give previous year. Please tell me how to do 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 = "[$-409]dd/mmm/yy ": .Value = ED
End With
End With
End Sub