View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein \(MVP - VB\)[_1481_] Rick Rothstein \(MVP - VB\)[_1481_] is offline
external usenet poster
 
Posts: 1
Default How to use substitute function in macro?

Don't use the SUBSTITUTE function... since you are in a macro and your
substitution is pretty basic, use the VBA Replace function instead (it will
be faster)..

myCell.Offset(0, 5).Value = Replace(Sheets("Temp").Range("$J$15").Value,
"B", "")

Rick


"Eric" wrote in message
...
Does anyone have any suggestions on using substitute function in macro?
I would like to remove any "B" character within the return value from
Sheets("Temp").Range("$J$15").Value.

------------------------------
Macro coding
myCell.Offset(0, 5).Value = Sheets("Temp").Range("$J$15").Value
------------------------------

For example
if the return value for Sheets("Temp").Range("$J$15").Value is 25.8B, then
I
would like to substitute "B" with "", which should return 25.8 into
myCell.Offset(0, 5).Value.
Does anyone have any suggestions?
Thanks in advance for any suggestions
Eric