Sub changedate()
r = Cells(Rows.Count, 10).End(3).Row
Application.ScreenUpdating = False
arr = Cells(4, 10).Resize(r - 3)
Cells(4, 10).Resize(r - 3).Clear
Cells(4, 10).Resize(r - 3).Borders.LineStyle = xlContinuous
For j = 1 To UBound(arr)
If Len(arr(j, 1)) > 0 Then
If Len(arr(j, 1)) < 6 Then
arr(j, 1) = CDate(arr(j, 1))
Else
arr(j, 1) = Replace(Replace(arr(j, 1), ".", "/"), "-", "/")
If Len(arr(j, 1)) = 8 And InStr(arr(j, 1), "/") = 0 Then
arr(j, 1) = Left(arr(j, 1), 4) & "/" & Mid(arr(j, 1), 5, 2) & "/" & Right(arr(j, 1), 2)
End If
End If
End If
Next j
Cells(4, 10).Resize(r - 3) = arr
Application.ScreenUpdating = True
End Sub
|