+ Reply to Thread
Results 1 to 7 of 7

Convert Excel formula into VBA code

  1. #1
    Registered User
    Join Date
    10-27-2009
    Location
    Indianapolis, IN
    MS-Off Ver
    Excel 2003
    Posts
    26

    Convert Excel formula into VBA code

    I have an Excel formula I'm having trouble converting into a VBA code.

    Please Login or Register  to view this content.
    Thanks for your assistance.

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Convert Excel formula into VBA code

    Grumpy9215,

    You can use the formula directly with the Evaluate method:
    Please Login or Register  to view this content.


    However, if you want code to repeat the steps the formula is taking, it would look something like this:
    Please Login or Register  to view this content.
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Convert Excel formula into VBA code

    Hello Grumpy9215,

    This code is untested but should work. However, there is no error handling added to this. Try it out and let me know the results.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  4. #4
    Registered User
    Join Date
    10-27-2009
    Location
    Indianapolis, IN
    MS-Off Ver
    Excel 2003
    Posts
    26

    Re: Convert Excel formula into VBA code

    Thank you for your assisatnce.

  5. #5
    Registered User
    Join Date
    04-24-2017
    Location
    slovakia
    MS-Off Ver
    2010
    Posts
    2

    Re: Convert Excel formula into VBA code

    sorry, thank you
    Last edited by palioli; 08-20-2017 at 05:11 AM.

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,830

    Re: Convert Excel formula into VBA code

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  7. #7
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Convert Excel formula into VBA code

    Deleted bcause posted at same moment as Ali.

    @ Ali

    Can I (or you) remove this post ?
    Last edited by bakerman2; 08-20-2017 at 04:42 AM.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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