I'm trying to get vba to recognize Pi aka Chr(227).
I've tried to compare it to Chr(227) but it still comes back that it's looking for 'p'...
if txt = Chr(227) then....
I'm trying to get vba to recognize Pi aka Chr(227).
I've tried to compare it to Chr(227) but it still comes back that it's looking for 'p'...
if txt = Chr(227) then....
The important thing is the font name and the character code to be used.
The following code inserts "Pi" in cell A1 and reads it as "p" because VBA editor does not support the font "Symbol"
![]()
Please Login or Register to view this content.
Last edited by Haluk; 07-22-2020 at 12:34 PM.
is there a way to search a string for the symbol and replace it?
so currently i have:
a cell containing 2*PI()*r and i'm converting it to 2*3.1415*$D$5 (where D5 is my 'r' cell)
I want the cell to contain 2*π*r ... where π is actually chr(227).. so i get 2*π*$D$5 .. so i'm guessing that's not possible
I do split the string up by the '*' so i do have 'π' on it's own..
looping through the string when i come across PI i sub in 3.1415
HTML Code:
there's no way to say some like - if Txt like ASC(227) then... since vba sees 'π' as a 'p' and calls it ASC(112) correct?
I can create a reference cell on my sheet that does recognize symbols so i could just use π in my formula and hide my reference. If i do that is there a way to sub out instances of 3.1415 for π
I may misunderstood your explanation but, try this.
For example in cell L1 enter this:
Now, while the cursor is still in cell L1 enter the "Name Box" which is located at the top-left of the Excel window, left to the formula bar; enter π and press ENTER.![]()
Please Login or Register to view this content.
Now, in any cell you can use something like this:
![]()
Please Login or Register to view this content.
I'm not using named ranges.
I"m searching a column ('E' in this case) when ever its not a number
where Char is an array of symbols such as *, (, ^, +,-... etc
HTML Code:
I did this because I need to use things like c, t1, and other "variables" that excel doesn't let you use.
I'll probably just make π one of my variable names and hide that row. That way when my code goes looking for 'π' it will use PI() in it's place, then sub out 3.1415 instances for Chr(227) ... if that's possible
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks