Hello,
I have a sheet that includes a list of datetime values in column B, I am using this code to loop through all rows to replace the number in each cell with only the date part of the number using the FIX function, but when I run the code VB returns an error "Object doesn't support this property or method. I can't figure out what is the problem. I appreciate someone's help.
I have a sheet that includes a list of datetime values in column B, I am using this code to loop through all rows to replace the number in each cell with only the date part of the number using the FIX function, but when I run the code VB returns an error "Object doesn't support this property or method. I can't figure out what is the problem. I appreciate someone's help.
VBA Code:
Sub ConvertDateValues()
Dim lRow As Long
Dim lLastRow As Long
Dim vCellDateNumber As Variant
lLastRow = Worksheets("Sheet1").UsedRange.Rows.Count
For lRow = lLastRow To 2 Step -1
vCellDateNumber = Cells(lRow, 2).Value
Range(Cells(lRow, 2)).Value = Application.WorksheetFunction.Fix(vCellDateNumber)
Next lRow
End Sub