vba best code optimization code example
Example: vba code for cutoff time
Option Explicit
Sub stripTime()
Dim i As Integer
With Worksheets("Sheet1")
i = Abs(Not IsDate(.Cells(1, 1).Value))
With .Range(.Cells(1 + i, "A"), .Cells(.Rows.Count, "A").End(xlUp))
.TextToColumns Destination:=.Cells(1, "C"), DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, xlDMYFormat), Array(10, xlSkipColumn))
.Offset(0, 2).NumberFormat = "[color10]dd-mmm-yyyy_)"
.Offset(0, 2).EntireColumn.AutoFit
End With
End With
End Sub