+ Reply to Thread
Results 1 to 7 of 7

Moving formulas into VBA

  1. #1
    Forum Contributor
    Join Date
    07-30-2012
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    139

    Moving formulas into VBA

    I realize this is an incredibly simplisitc question, I've heard that it is possible to run all formulas in the background in VBA as opposed to placing them in specific cells. Normally if I wanted to sum a range of cells I would go the cell that I want to contain the answer and I would put something like:

    Please Login or Register  to view this content.
    and it would give me a total. is it possible to leave the cell blank and have that math in VBA somewhere?

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Moving formulas into VBA

    Sure, you can use the Evaluate function in VBA to run a formula.

    Please Login or Register  to view this content.


    If you want it to be more dynamic and figure out how much data is in column C and run the formula for that many cells:

    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 08-01-2012 at 03:38 PM.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Contributor
    Join Date
    07-30-2012
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    139

    Re: Moving formulas into VBA

    Thank you very much! :D

    ---------- Post added at 12:51 PM ---------- Previous post was at 12:42 PM ----------

    Hmmm, ok, I just tried it and it didn't work. I guess I should have saved the thanking till I had test it><

    Anyways, is there a prefix and suffix I need on this code of some sort, Sub/ Endsub etc?

  4. #4
    Forum Contributor
    Join Date
    01-20-2012
    Location
    Amsterdam, The Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    186

    Re: Moving formulas into VBA

    aye, always place your code between

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    07-30-2012
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    139

    Re: Moving formulas into VBA

    Got it,

    thanks!

    Sorry! I'm about a week old of self teach on VBA.

  6. #6
    Forum Contributor
    Join Date
    01-20-2012
    Location
    Amsterdam, The Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    186

    Re: Moving formulas into VBA

    no problem, glad to help

  7. #7
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Moving formulas into VBA

    Heh, yeah, I was just testing you, honest.

+ 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