Re: Replacing specific text within a table cell

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



In article <7588A428-C8E7-4F9D-BC98-E9553F901749@xxxxxxxxxxxxx>, Barb Reinhardt
wrote:
It's with specifically identified cells and is not a global change. I've
actually determine how to do this, but the results are now strings and I need
them to be numeric. How can I resolve this?

Textranges contain strings, never numerics. I'm guessing you need to convert values
like "$500M" to something that you can convert to numerics?

Something like this, assuming you've got the value you want to work with in sTemp, a
string variable:

sTemp = Replace(sTemp,"M","")
sTemp = Replace(sTemp,"$","")
' and depending on whether you plan to use val(sTemp) or cdbl(sTemp) or
' something else to convert to numeric, you may also want to
' eliminate commas
sTemp = Replace(sTemp,",","")

Now Cdbl(sTemp) or Val(sTemp) gives you a numeric


Thanks,
Barb Reinhardt

"John Wilson" wrote:

Hi Barb

Is this "M" and" $" as discreet words or within other words. Surely
replacing all M's with "" would give some unexpected results?
--
Amazing PPT Hints, Tips and Tutorials-http://www.PPTAlchemy.co.uk
http://www.technologytrish.co.uk/ppttipshome.html
email john AT technologytrish.co.uk


"Barb Reinhardt" wrote:

I have identified a specific textrange that I want to replace text in, but am
not sure how to go about doing it. I want to change "M" to "" and "$" to ""
in that text range. Can someone assist?

Thanks,
Barb Reinhardt


-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================


.



Relevant Pages

  • Re: Evil type coercion
    ... > Try reading the original posts Russ, ... containing strings and numerics are compared, ... actually you were the unwitting victim of a rule in which no type coercion ...
    (microsoft.public.vb.syntax)
  • Re: A nongeneric bounded string array type (in database code)
    ... > and all numerics must be marshalled into and out of strings, ... Of course, I don't use strings for numeric data, and when I use ... Quality is scientific reality. ... -- from Zen and the Art of Motorcycle ...
    (comp.lang.ada)
  • Re: Sorting help
    ... manipulated as numerics, and sorted as numerics. ... Subject: Sorting help ... What is the best way to sort such an array of strings? ...
    (comp.lang.ruby)
  • Re: Data Type Change while using FSO?
    ... treat them as strings. ... So, you need two AddSQL functions, or an additional ... argument that tells what type of delimiter (nothing for numerics, ... I receive a data type mismatch error on import. ...
    (microsoft.public.inetserver.asp.general)