numbers to dates
Dim rng as Range, cell as Range
set rng = Range(Cells(1,ActiveCell.Column), _
Cells(rows.count,ActiveCell.Column).End(xlup))
for each cell in rng
if len(cell.Text) = 7 then
Cell.Value = "'0" & Format(cell.value,"0000000")
End if
Next
--
Regards,
Tom Ogilvy
"Marc" wrote in message
om...
I have a column of numbers that I need to convert to dates, such as:
7252003
11152001
3312002
Some have length of 7, and some are 8. I can do this manually by
adding "0" to the 7 length numbers, then Data, Text to Columns/Date.
Is there a way to do this (faster) in a macro?
Thanks,
Marc
|