Jagwarman
asked on
excel 201 change format from text no number
I'm using 201 and when I insert a row of numbers some of them change to text. there are over 2000 items in the column. I need some vba code [as this is part of a macro] to change the entire column to number format.
thanks
thanks
Columns("A:A").Select
Selection.NumberFormat = "0.00"
Selection.NumberFormat = "0.00"
Or better
Columns("A:A").NumberForma t = "0.00"
Columns("A:A").NumberForma
ASKER
MartinLiss I tried this but it does not work.
What I am doing is copying from another file then stripping out 7 characters from the cell. In so doing the cell becomes text. I get that little green triangle top left that when you click on it, it says "the number in this cell is formatted as text or preceded by an apostrophy. The when I open that I can convert it to a number. When I do it manually that way it works.
So, is there a way to convert it to a number using VBA. As I said your solution [unfortunately] did not work.
thanks
What I am doing is copying from another file then stripping out 7 characters from the cell. In so doing the cell becomes text. I get that little green triangle top left that when you click on it, it says "the number in this cell is formatted as text or preceded by an apostrophy. The when I open that I can convert it to a number. When I do it manually that way it works.
So, is there a way to convert it to a number using VBA. As I said your solution [unfortunately] did not work.
thanks
Here's an article that should help.
ASKER
Hi MartinLiss.
I found this code but I have to 'manually' highlight the column. Would you be able to make a change to the code so that it works by selecting Column B
Sub ConvertTextNumbers()
Dim rUsedRange As Range
' Convert all cells with numbers from text to numbers
For Each rUsedRange In Intersect(ActiveSheet.Used Range, Selection).Areas
rUsedRange.Value = rUsedRange.Value
Next rUsedRange
End Sub
Thanks
I found this code but I have to 'manually' highlight the column. Would you be able to make a change to the code so that it works by selecting Column B
Sub ConvertTextNumbers()
Dim rUsedRange As Range
' Convert all cells with numbers from text to numbers
For Each rUsedRange In Intersect(ActiveSheet.Used
rUsedRange.Value = rUsedRange.Value
Next rUsedRange
End Sub
Thanks
Did you look at the article I posted?
ASKER
I did but unfortunately it didn't help me
Regards
Regards
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Martin brilliant just what I needed.
You're welcome and I'm glad I was able to help.
Marty - MVP 2009 to 2013
Marty - MVP 2009 to 2013
ASKER
thanks