Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default symbols in VBA

I have a macro in which I have a formula which subsitutes symbols for numbers
but VBA turns all the symbols to "?". The formula is as follows:

=IF(I4=1,SUBSTITUTE(I4,1,"ˆš",1),IF(I4=2,SUBSTITU TE(I4,2,"?",1),IF(I4=3,SUBSTITUTE(I4,3,"—",1),IF (I4=0,SUBSTITUTE(I4,0,"—‹",1)))))

How can I gat VBA to use the ˆš — and —‹ symbols in the formula?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 142
Default symbols in VBA

On May 2, 1:47Β*pm, Pierre M wrote:
I have a macro in which I have a formula which subsitutes symbols for numbers
but VBA turns all the symbols to "?". The formula is as follows:

=IF(I4=1,SUBSTITUTE(I4,1,"ˆš",1),IF(I4=2,SUBSTITU TE(I4,2,"?",1),IF(I4=3,SUBSΒ*TITUTE(I4,3,"—",1), IF(I4=0,SUBSTITUTE(I4,0,"—‹",1)))))

How can I gat VBA to use the ˆš — and —‹ symbols in the formula?


You could use the character code...
=IF(I4=1,SUBSTITUTE(I4,1,CHAR(0),1),IF(I4=2,SUBSTI TUTE(I4,2,CHAR(63),
1),IF(I4=3,SUBSTITUTE(I4,3,CHAR(7),
1),IF(I4=0,SUBSTITUTE(I4,0,CHAR(176),1)))))
The exception is CHAR(0) for the first substitution. I'm not sure off
hand what character the sqrt symbol is. It may be that you have to
find somewhere to put the symbols (on another sheet or something) then
refer to the corresponding cell in your formula. I put the symbols
into A1, A2, A3, and A4 on the same sheet. Then wrote my formula like
this:

=IF(I4=1,SUBSTITUTE(I4,1,A11),IF(I4=2,SUBSTITUTE(I 4,2,A2,1),IF(I4=3,SUBSTITUTE(I4,3,A3,1),IF(I4=0,SU BSTITUTE(I4,0,A4,1)))))

It worked and you can definately write that from VBA.

Hope this helps...
Rob

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default symbols in VBA

Hi Rob,

Thanks for your response, it worked but for the "ˆš" symbol of course. Is
there a table of characters from which to choose that corresponds to the
CHAR( )? Or is there a way to define a font and character code in RTF?

"okrob" wrote:

On May 2, 1:47 pm, Pierre M wrote:
I have a macro in which I have a formula which subsitutes symbols for numbers
but VBA turns all the symbols to "?". The formula is as follows:

=IF(I4=1,SUBSTITUTE(I4,1,"ˆš",1),IF(I4=2,SUBSTITU TE(I4,2,"?",1),IF(I4=3,SUBSΒ*TITUTE(I4,3,"—",1), IF(I4=0,SUBSTITUTE(I4,0,"—‹",1)))))

How can I gat VBA to use the ˆš — and —‹ symbols in the formula?


You could use the character code...
=IF(I4=1,SUBSTITUTE(I4,1,CHAR(0),1),IF(I4=2,SUBSTI TUTE(I4,2,CHAR(63),
1),IF(I4=3,SUBSTITUTE(I4,3,CHAR(7),
1),IF(I4=0,SUBSTITUTE(I4,0,CHAR(176),1)))))
The exception is CHAR(0) for the first substitution. I'm not sure off
hand what character the sqrt symbol is. It may be that you have to
find somewhere to put the symbols (on another sheet or something) then
refer to the corresponding cell in your formula. I put the symbols
into A1, A2, A3, and A4 on the same sheet. Then wrote my formula like
this:

=IF(I4=1,SUBSTITUTE(I4,1,A11),IF(I4=2,SUBSTITUTE(I 4,2,A2,1),IF(I4=3,SUBSTITUTE(I4,3,A3,1),IF(I4=0,SU BSTITUTE(I4,0,A4,1)))))

It worked and you can definately write that from VBA.

Hope this helps...
Rob


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 142
Default symbols in VBA

On May 3, 8:59Β*am, Pierre M wrote:
Hi Rob,

Thanks for your response, it worked but for the "ˆš" symbol of course. Is
there a table of characters from which to choose that corresponds to the
CHAR( )? Or is there a way to define a font and character code in RTF?



"okrob" wrote:
On May 2, 1:47 pm, Pierre M wrote:
I have a macro in which I have a formula which subsitutes symbols for numbers
but VBA turns all the symbols to "?". The formula is as follows:


=IF(I4=1,SUBSTITUTE(I4,1,"ˆš",1),IF(I4=2,SUBSTITU TE(I4,2,"?",1),IF(I4=3,SUBSΒ*Β*TITUTE(I4,3,"—",1 ),IF(I4=0,SUBSTITUTE(I4,0,"—‹",1)))))


How can I gat VBA to use the ˆš — and —‹ symbols in the formula?


You could use the character code...
=IF(I4=1,SUBSTITUTE(I4,1,CHAR(0),1),IF(I4=2,SUBSTI TUTE(I4,2,CHAR(63),
1),IF(I4=3,SUBSTITUTE(I4,3,CHAR(7),
1),IF(I4=0,SUBSTITUTE(I4,0,CHAR(176),1)))))
The exception is CHAR(0) for the first substitution. Β*I'm not sure off
hand what character the sqrt symbol is. Β*It may be that you have to
find somewhere to put the symbols (on another sheet or something) then
refer to the corresponding cell in your formula. Β*I put the symbols
into A1, A2, A3, and A4 on the same sheet. Β*Then wrote my formula like
this:


=IF(I4=1,SUBSTITUTE(I4,1,A11),IF(I4=2,SUBSTITUTE(I 4,2,A2,1),IF(I4=3,SUBSTITΒ*UTE(I4,3,A3,1),IF(I4=0, SUBSTITUTE(I4,0,A4,1)))))


It worked and you can definately write that from VBA.


Hope this helps...
Rob- Hide quoted text -


- Show quoted text -


Actually, after trying it several times, I couldn't find a way to
bring that character up. It's not part of the 255 characters that
CHAR() refers to. I found the best way was just putting the character
into a separate cell, and refering to it as with my second solution.
Also, the characters for —‹ and — weren't the right ones either. As I
looked into it a little further, they aren't one of the 255.
Someone else may be able to help more, but again, the second solution
will work.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default symbols in VBA

Thanks Rob, I got it to work with a combination of "CHAR" commands and
grabbing the symbol from another sheet as you suggested but I had to use a
"Sheet2!R1C1" format for the location of the symbol's cell, just using "A1"
for example did not work. BTW CHAR(7) and CHAR(176) did display — and —‹
correctly in our environment. I have noticed a few other differences in our
VBA configuration. Maybe a different version?

Anyway, thanks again.

Pierre

"okrob" wrote:

On May 3, 8:59 am, Pierre M wrote:
Hi Rob,

Thanks for your response, it worked but for the "ˆš" symbol of course. Is
there a table of characters from which to choose that corresponds to the
CHAR( )? Or is there a way to define a font and character code in RTF?



"okrob" wrote:
On May 2, 1:47 pm, Pierre M wrote:
I have a macro in which I have a formula which subsitutes symbols for numbers
but VBA turns all the symbols to "?". The formula is as follows:


=IF(I4=1,SUBSTITUTE(I4,1,"ˆš",1),IF(I4=2,SUBSTITU TE(I4,2,"?",1),IF(I4=3,SUBSΒ*Β*TITUTE(I4,3,"—",1 ),IF(I4=0,SUBSTITUTE(I4,0,"—‹",1)))))


How can I gat VBA to use the ˆš — and —‹ symbols in the formula?


You could use the character code...
=IF(I4=1,SUBSTITUTE(I4,1,CHAR(0),1),IF(I4=2,SUBSTI TUTE(I4,2,CHAR(63),
1),IF(I4=3,SUBSTITUTE(I4,3,CHAR(7),
1),IF(I4=0,SUBSTITUTE(I4,0,CHAR(176),1)))))
The exception is CHAR(0) for the first substitution. I'm not sure off
hand what character the sqrt symbol is. It may be that you have to
find somewhere to put the symbols (on another sheet or something) then
refer to the corresponding cell in your formula. I put the symbols
into A1, A2, A3, and A4 on the same sheet. Then wrote my formula like
this:


=IF(I4=1,SUBSTITUTE(I4,1,A11),IF(I4=2,SUBSTITUTE(I 4,2,A2,1),IF(I4=3,SUBSTITΒ*UTE(I4,3,A3,1),IF(I4=0, SUBSTITUTE(I4,0,A4,1)))))


It worked and you can definately write that from VBA.


Hope this helps...
Rob- Hide quoted text -


- Show quoted text -


Actually, after trying it several times, I couldn't find a way to
bring that character up. It's not part of the 255 characters that
CHAR() refers to. I found the best way was just putting the character
into a separate cell, and refering to it as with my second solution.
Also, the characters for —‹ and — weren't the right ones either. As I
looked into it a little further, they aren't one of the 255.
Someone else may be able to help more, but again, the second solution
will work.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Symbols on the keyboard are not the symbols on the screen.... Lisha Excel Discussion (Misc queries) 2 May 22nd 10 07:29 AM
Symbols Crissy Excel Worksheet Functions 8 April 15th 09 05:13 AM
Symbols Crissy Excel Discussion (Misc queries) 4 April 14th 09 05:38 AM
symbols hugoalegria Excel Discussion (Misc queries) 6 May 12th 08 10:39 PM
add symbols to DMS surveyor Excel Programming 1 March 2nd 05 09:49 PM


All times are GMT +1. The time now is 02:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"