dd/mm/yy from general format


Posted by Dylan on July 18, 2000 8:38 AM

Is there a way to delete parts of a cell or convert text to dd/mm/yy.

I.e. I have a date eg 20/06/2000 (in general format). I want it to be in this format dd/mm/yy (20/06/00) however it doesn't want to.

Is there a way to go through the sheet correcting this.

NB some cells already contain the format dd/mm/yy - so i suppose I'm looking for something to delete the 20 from 2000 and the convert it to dd/mm/yy.

Does anybody know how to do this or has a better way.

Thanks

Dylan.



Posted by Ryan on July 18, 0100 3:03 PM

Dylan,

If you select a range first and then run this macro it will take away the 2000 and change the number format to dd/mm/yy. Let me know how it works!

Ryan

Sub ChangeDateFormat()
For Each Cell In Selection

If Right(Cell, 4) = "2000" Then
With Cell
.Value = Left(Cell, Len(Cell) - 4) & "00"
.NumberFormat = "dd/mm/yy"
End With
End If
Next Cell
End Sub