Number with dash is importing as date
Put this in a loop going down the column of data. If Excel thinks it's a
date, it'll change the value to text.
If IsDate(ActiveCell.Value) Then
ActiveCell.Value = "'" & Format(ActiveCell.Value, "mmyyyy")
End If
--
Hope this helps.
If it does, please click the Yes button.
Thanks in advance for your feedback.
Gary Brown
"Dee Sperling" wrote:
An Excel spreadsheet is being exported from a SQL database that I cannot
change, so I need to accomplish this in Excel.
Sometimes, some of the many numbers contain a dash which Excel then
interprets as a date. I can remove the dash programatically, but the number
is not correct afterwards.
For example, the number imported is 05-9078 which is displayed in Excel as
May-78, but is actually stored as 5/1/9078. Changing the cell format to
number or text gives me 2621833.
I need to be able to add to my macro something that will give me back the
original number so that I can remove the dash and end up with 059078
Any help greatly appreciated.
Dee
|