+ Reply to Thread
Results 1 to 5 of 5

recognizing Pi, but the symbol

  1. #1
    Forum Contributor
    Join Date
    04-16-2020
    Location
    Alberta, Canada
    MS-Off Ver
    365
    Posts
    216

    recognizing Pi, but the symbol

    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....

  2. #2
    Valued Forum Contributor Haluk's Avatar
    Join Date
    02-14-2019
    Location
    Turkiye
    MS-Off Ver
    2010 - 64 Bit on Windows-11 (22 H2) 64 Bit
    Posts
    1,155

    Re: recognizing Pi, but the symbol

    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.

  3. #3
    Forum Contributor
    Join Date
    04-16-2020
    Location
    Alberta, Canada
    MS-Off Ver
    365
    Posts
    216

    Re: recognizing Pi, but the symbol

    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 π

  4. #4
    Valued Forum Contributor Haluk's Avatar
    Join Date
    02-14-2019
    Location
    Turkiye
    MS-Off Ver
    2010 - 64 Bit on Windows-11 (22 H2) 64 Bit
    Posts
    1,155

    Re: recognizing Pi, but the symbol

    I may misunderstood your explanation but, try this.

    For example in cell L1 enter this:

    Please Login or Register  to view this content.
    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.

    Now, in any cell you can use something like this:

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    04-16-2020
    Location
    Alberta, Canada
    MS-Off Ver
    365
    Posts
    216

    Re: recognizing Pi, but the symbol

    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

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to replace decimal symbol Comma to decimal symbol Dot above bars in chart?
    By yourfriend0 in forum PowerPoint Formatting & General
    Replies: 1
    Last Post: 07-05-2020, 04:55 AM
  2. [SOLVED] Return numerical value without symbol if cell contains symbol
    By cdad in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 01-05-2018, 04:57 AM
  3. how do I change the dollar symbol to euro symbol
    By Arpita_Excel in forum Excel General
    Replies: 5
    Last Post: 07-20-2015, 02:26 AM
  4. MS Excel Rupee Symbol Not Displaying as a different symbol
    By perpectuals in forum Excel General
    Replies: 1
    Last Post: 07-02-2015, 07:03 AM
  5. [SOLVED] Split Data from one sheet into multiple sheets by recognizing a symbol (=)
    By jstewart22 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-15-2013, 09:31 AM
  6. Checking for a symbol then copying text if it symbol is present
    By fedorafreak in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-03-2013, 08:54 PM
  7. Tick symbol & cross symbol in a cell
    By sivdin in forum Excel General
    Replies: 2
    Last Post: 02-17-2011, 08:58 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1