Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Pedro Silva   on Nov 09 In MS Office Category.

  
Question Answered By: Joyce Edwards   on Nov 09

sorry, I must have been half asleep when I sent the last email
and got it mixed up with a different question!

I tried what you suggested, but after importing the file  as text, then
changing the format  to General, the numbers  were still formatted as text
(with the little green triangle in the corner to indicate Excel realises the
cell contains a number formatted as text).

I tried submitting a similar question on an internet forum, and someone
suggested I use the following code to convert the cells to numbers:

For Each a In Range(Cells(1, "B"), Cells(Cells.Rows.Count, "B").End(xlUp))
With a
If Len(.Value) > 0 Then .Value = .Value * 1
End With
Next

It did end up helping to fix the problem, although I thought there may have
been a simpler way (without needing to loop through all the cells). If I
select the whole column  and click one of the smart tags to convert the text
to numbers, they all get converted - I was hoping the same thing could be
done using VBA, but I guess I should be thankful that the above For Next
loop gets the results I want.

Share: 

 

This Question has 3 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Import CSV file Or get search suggestion and latest updates.


Tagged: