Hi Guys,
I have the below code which is working great, but the part of the code which changes the number format in Column D to "d/m", I need this to only work on cells containing dates. Within Column D I have address numbers, some are automatically held as dates, but some may be single numbers like "6". After I format using the above 6 would show as 6/1.... I understand dates are essnaitally large numbers, so if there is way to only Numberformat cells greater tha
n say 2000, then this would work. But I'm not sure hwo to write this within the code...
Thanks,
I have the below code which is working great, but the part of the code which changes the number format in Column D to "d/m", I need this to only work on cells containing dates. Within Column D I have address numbers, some are automatically held as dates, but some may be single numbers like "6". After I format using the above 6 would show as 6/1.... I understand dates are essnaitally large numbers, so if there is way to only Numberformat cells greater tha
VBA Code:
Sub AddressFix()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Columns("A:M").HorizontalAlignment = xlCenter
Columns("D:D").Replace What:="0", Replacement:="", LookAt:=xlPart
Columns("D:D").Replace What:=" ", Replacement:="", LookAt:=xlPart
Dim c As Range
For Each c In Range("D1:D" & Cells(Rows.Count, "D").End(xlUp).Row)
If c.Value = "" Then c.Value = c.Offset(, -1).Value
Next
Columns("A").ColumnWidth = 17
Range("D2:D200").NumberFormat = "d/m"
Range("C2:C200").ClearContents
End Sub
Thanks,