Sub t() Dim a As Range Dim b As String For Each a In Range(Selection.End(xlUp), Selection.End(xlDown)) If Len(a) = 8 Then b = Format(a, "####-##-##") If IsDate(b) Then a = FormatDateTime(b, vbShortDate) End If End If Next a End Sub
toto = "20120216" MsgBox DateSerial(Left(toto, 4), Mid(toto, 5, 2), Mid(toto, 7))