|
-
May 3rd, 2007, 07:28 AM
#1
Thread Starter
Addicted Member
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
Last edited by Mitch_s_s; May 3rd, 2007 at 10:08 AM.
-
May 3rd, 2007, 07:32 AM
#2
Re: Number Stored as text
set the numberformat of the cell or range
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
May 3rd, 2007, 07:35 AM
#3
Thread Starter
Addicted Member
Re: Number Stored as text
do you mean
range("Myrange").NumberFormat = "0.00"
-
May 3rd, 2007, 07:47 AM
#4
Re: Number Stored as text
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
May 3rd, 2007, 07:48 AM
#5
Thread Starter
Addicted Member
Re: Number Stored as text
my original post covers that
it doesnt seem to work
the number is still stored as text
-
May 3rd, 2007, 08:00 AM
#6
-
May 3rd, 2007, 08:01 AM
#7
-
May 3rd, 2007, 08:37 AM
#8
Re: Number Stored as text
He tried that
 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?
-
May 3rd, 2007, 08:55 AM
#9
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...
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
May 3rd, 2007, 10:05 AM
#10
Thread Starter
Addicted Member
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!!! 
it's a csv export from a SQL query.
thanks for your quick response
-
May 3rd, 2007, 11:34 PM
#11
Hyperactive Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|