Changing Text into Numbers, using VBA

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

When importing from a FoxPro database, all the charactors come over as text. When I try to sum these numbers, it will not sum because excel thinks they are text. Isn't there a way to convert all these to numbers through vba?
 
Hi
one way (non-VBA):
select and empty cell and copy it
- select your imported values
- goto 'Edit - Paste Special' and choose 'Add'
 
No offence Frank, but all the advice I have gotten from you has been shall we say lame. There is 20 ways to manually do the text to numbers thing, I can do that. I am looking to do it with vba so I don't have to do it manually. Thanks anyway

----- Frank Kabel wrote: ----

H
one way (non-VBA)
select and empty cell and copy i
- select your imported value
- goto 'Edit - Paste Special' and choose 'Add

--
Regard
Frank Kabe
Frankfurt, German


Cecil wrote
 
Cecil, for a person looking for help your attitude has has been rather shall
we say lame?

--

Vasant


cecil said:
No offence Frank, but all the advice I have gotten from you has been shall
we say lame. There is 20 ways to manually do the text to numbers thing, I
can do that. I am looking to do it with vba so I don't have to do it
manually. Thanks anyway.
 
Sub ffff()
Dim C As Range
For Each C In Range("c1:c10")
C.NumberFormat = "0"
C.Value = C.Value
Next
End Su
 
So
try something like
sub foo()
dim rng as range
dim cell as range
set rng = selection
for each cell in rng
if cell.value<>""
cell.numberformat="General"
cell.value=cell.value
end if
next
end sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top