+ Reply to Thread
Results 1 to 6 of 6

convert string to formula

  1. #1
    Registered User
    Join Date
    11-11-2004
    Location
    Czech Republic
    MS-Off Ver
    Excel 2016 for Windows 10
    Posts
    22

    Question convert string to formula

    Hello everybody,

    I'm trying to make code for calculation from string. I want to write a general formula into cell A1 - example: (F+H)/2 or (G-I+3)*2. Everything is in Form.

    1. step - analize of formula

    Please Login or Register  to view this content.
    step 2. - result
    when formula in cell A1 is (F+G)/2 and myvalue1 = 5 and myvalue2 = 3 -> I get string myformula = (5+3)/2

    step 3. - question
    Would anyone know and help, how to calculate this "formula" and get myvalue10 = result of myformula?
    myvalue10 is in Form too (not written to cell as formula)

    Thanks

    Martin
    Last edited by MartyZ; 08-09-2012 at 10:44 AM.

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: convert string to formula

    Welcome to the forum.

    I have added code tags to your post. As per forum rule 3, you need to use them whenever you put any code in your post. Please add them in future. If you need more information on how to use them, check my signature.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: convert string to formula

    Please Login or Register  to view this content.
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  4. #4
    Registered User
    Join Date
    11-11-2004
    Location
    Czech Republic
    MS-Off Ver
    Excel 2016 for Windows 10
    Posts
    22

    Re: convert string to formula

    to Arlu1201: Sorry, thank You.

    ---------- Post added at 01:32 PM ---------- Previous post was at 01:27 PM ----------

    to JosephP: I tried it, but it dosn't work. I got Run-time error -2147352571 (80020005) Could not set Value property. Type mischmasch.

    Any idea why?

  5. #5
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: convert string to formula

    perhaps your formula string is incorrect.

  6. #6
    Registered User
    Join Date
    11-11-2004
    Location
    Czech Republic
    MS-Off Ver
    Excel 2016 for Windows 10
    Posts
    22

    Re: convert string to formula

    Thank You very much JosephP. The problem was, that the decimal number was loaded into string with "," and not ".".

    So I gave there
    Please Login or Register  to view this content.
    and it works!

    Once more, many thanks!!!

    Martin

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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