View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Charlotte E Charlotte E is offline
external usenet poster
 
Posts: 59
Default Replacing 1/3 and 2/3

Hey,


I have a VBA code, which return the result into a worksheet cell, in the
form of a test string.

The result string can be one of the following:

- "You need to use 1/4 of the basis"
- "You need to use 1/2 of the basis"
- "You need to use 3/4 of the basis"
- "You need to use 1/3 of the basis"
- "You need to use 2/3 of the basis"

It's the two last ones that causes me problems....


I want the text in the cell to be like this:

- "You need to use ¼ of the basis"
- "You need to use ½ of the basis"
- "You need to use ¾ of the basis"

So I simply use a code line like:

ReturnString = Replace(ReturnString," 1/2 "," ½ ")

And that's no problem with 1/4, 1/2 and 3/4, but when I try to make the
Replace with 1/3 and 2/3, all I get is a questionmark, in the Replace line,
when I try to copy the char for 1/3 into the line???

ReturnString = Replace(ReturnString," 1/3 "," ? ")

How to do it?


TIA,