I have what seems like it should be a simple piece of code but I have too many gaps in my own knowledge base to figure out. I have found multiple pieces in my research but have been unable to pull it all together. I need to remove the time stamp from date time values in a column. Some of the cells are blank. I want to do nothing if the cell is blank, if the cell has a date time value I want to strip out the time value, and then continue to the end.
[VBA]Sub ToDate()
Dim LR As Long, i As Long
LR = Range("I" & Rows.Count).End(xlUp).Row
For i = 2 To LR
If Not IsEmpty(Cells(i, 2)) Then
With Range("I" & i)
.NumberFormat = "mm/dd/yy"
.Value = CLng(.Value)
End With
End If
Next i
End Sub[/VBA]
If anyone can help me correct my code I would appreciate it.
Thanks!