Number Stored as text[RESOLVED]
Hi as the title says, i have a number stored as text in a cell.
I know there must be a way to convert this to a number format, but when i format the cell to Number it does not convert.
There is the error message button, but when recording a macro it does not record this action.
I'd look in to this further, but it's the final piece of the code i need and it's pretty urgent.
Basic probably i know, but i;ve never come across it before.
I tried copying the value and storing it as a variable in vba
couldnt get Cint to work.
any help would be appreciated,
Thanks
Re: Number Stored as text
set the numberformat of the cell or range
Re: Number Stored as text
do you mean
range("Myrange").NumberFormat = "0.00"
Re: Number Stored as text
Re: Number Stored as text
my original post covers that
it doesnt seem to work
the number is still stored as text
Re: Number Stored as text
i think Cint() method will help u..chk out the VBA help...
Re: Number Stored as text
ooopsss...sorry ..its INT() not cint()
Re: Number Stored as text
He tried that
Quote:
Originally Posted by Mitch_s_s
I tried copying the value and storing it as a variable in vba couldnt get Cint to work.
Lets go back to basics.
How are you putting the number in the cell to begin with?
Re: Number Stored as text
Hi Mitch
Do me a small favor. Just check in the Formula bar on how the numbers are stored in the cell. It is possible that there is a ' (single quote) before the number for example '98732.
In this case the numbers will always be stored as text.
Two ways to get rid of it.
1) either manually delete the single quote or
2) write a code to loop thru the cells and delete the quote.
Hope this helps...
Re: Number Stored as text
thanks for the quick response
I've looped through the cells using int()
i tried Cint originally an that didnt work
int does the job!!! :D
it's a csv export from a SQL query.
thanks for your quick response :)
Re: Number Stored as text[RESOLVED]