Convert text to values

M

mp

cells have existing values - xls downloaded from a site- numbers come in
as text so I can't SUM(x:x) etc.

first guess to solve: loop thru entries, save value-convert string to
float, reformat cell, replace value?

easier idea?

Thanks
Mark
 
G

GS

mp formulated on Wednesday :
cells have existing values - xls downloaded from a site- numbers come in as
text so I can't SUM(x:x) etc.

first guess to solve: loop thru entries, save value-convert string to float,
reformat cell, replace value?

easier idea?

Thanks
Mark

See your original post in the other forum, where I added instructions
for how to use the formula I posted.

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
 
M

mp

mp formulated on Wednesday :

See your original post in the other forum, where I added instructions
for how to use the formula I posted.

I saw that GS, thanks. I took that in the context of that forum on how
to do it manually. This similar query was in the context of automating
it via vb(a).

I will be doing various calcs on the values so would rather convert the
data type from string to real, rather than use (function x) rather than
(function(value x)) each time.

Thanks
Mark
 
G

GS

mp pretended :
I saw that GS, thanks. I took that in the context of that forum on how to do
it manually. This similar query was in the context of automating it via
vb(a).

I will be doing various calcs on the values so would rather convert the data
type from string to real, rather than use (function x) rather than
(function(value x)) each time.

Thanks
Mark

Ok, Mark! I was going to offer a VBA solution but I'll hold off on that
for now. If you're interested to go that way then post back...

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
 
M

mp

for a VBA solution, assuming the cell's format is still "General", (the cell format shouldn't be changed by an import) you can simply do use this macro.

To enter this Macro (Sub),<alt-F11> opens the Visual Basic Editor.
Ensure your project is highlighted in the Project Explorer window.
Then, from the top menu, select Insert/Module and
paste the code below into the window that opens.

To use this Macro (Sub), first select the range of cells that need to be processed or define them some other way (and change the macro accordingly).

Then<alt-F8> opens the macro dialog box. Select the macro by name, and<RUN>.

======================
Option Explicit
Sub MakeNumeric()
Dim c As Range
For Each c In Selection
c.Value = c.Value
Next c
End Sub
=========================

I'll be darned, it's that easy? :) I wouldn't have intuitively arrived
at that!! :) thanks a bunch
Mark
 
I

isabelle

hi Ron,

why make a loop ?

Sub MakeNumeric()
Selection = Selection.Value
End Sub

--
isabelle



Le 2012-04-26 06:12, Ron Rosenfeld a écrit :
 
I

isabelle

phew, i was afraid for a moment that this solution was no longer possible with xl2007 +
thanks Ron, and have a good night

--
isabelle



Le 2012-04-27 20:15, Ron Rosenfeld a écrit :
 

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

Top