+ Reply to Thread
Results 1 to 5 of 5

Macro to replace formula with result when formula calculate

  1. #1
    Registered User
    Join Date
    03-25-2013
    Location
    New Delhi
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    37

    Macro to replace formula with result when formula calculate

    Hi everyone,

    I require a help on replacing the result of a formula in the range E23:E77 only when the formula activecell executes.

    I am using

    Code\
    range ("E23:E77").select
    Activecell.value=Activecell.value
    /code/

    But, it selects the entire range and remove the formulas from each cell.
    I want the macro to execute only when each cell calculates the formula.

    For eg when the formula in cell E23 executes then the value should replace the formula in that cell only and not the entire range and so on for the the other cells from E23 to E77.

  2. #2
    Valued Forum Contributor
    Join Date
    02-02-2016
    Location
    Indonesia
    MS-Off Ver
    Office 365
    Posts
    1,004

    Re: Macro to replace formula with result when formula calculate

    Try this.
    Put the macro in code module of the sheet (it use 'Worksheet_Calculate' event)
    Please Login or Register  to view this content.

  3. #3
    Valued Forum Contributor meabrams's Avatar
    Join Date
    10-03-2014
    Location
    USA
    MS-Off Ver
    2007, 2010, 2013, 2016
    Posts
    451

    Re: Macro to replace formula with result when formula calculate

    What cells does the formula look at?

    What I came up with look at E23:E77 but only fires if someone enters a formula (didnt read the entire Post at first)
    so it could probably be adjusted to work with what you are needing

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    03-25-2013
    Location
    New Delhi
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    37
    Quote Originally Posted by meabrams View Post
    What cells does the formula look at?

    What I came up with look at E23:E77 but only fires if someone enters a formula (didnt read the entire Post at first)
    so it could probably be adjusted to work with what you are needing

    Please Login or Register  to view this content.
    Hi meabrams,

    Thanks for the code.
    I have tried it but, the cells still have the formula.

    My formula is:

    cell E23 = cell J23
    Cell E24 = cell J24 and so on.

    I want the cell E23 to replace this formula with the answer from cell J23 when it executes and so on for rest of the cell till E77 = J77.

    Thanks again.

  5. #5
    Valued Forum Contributor
    Join Date
    02-02-2016
    Location
    Indonesia
    MS-Off Ver
    Office 365
    Posts
    1,004

    Re: Macro to replace formula with result when formula calculate

    Did you try my code in post#2? (it use 'Worksheet_Calculate' event)

+ 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. Macro to calculate formula automatically from a list of input and save each result
    By Alex Zana in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-07-2016, 07:07 AM
  2. Replies: 2
    Last Post: 05-13-2014, 01:18 PM
  3. Find and Replace of Formula Result
    By Rajeshkanna in forum Excel General
    Replies: 4
    Last Post: 05-24-2012, 03:38 AM
  4. Replace a formula with its result
    By mkelly1999 in forum Excel General
    Replies: 3
    Last Post: 03-26-2010, 07:02 PM
  5. Replace formula with result
    By Scrap74 in forum Excel General
    Replies: 3
    Last Post: 01-07-2010, 04:04 AM
  6. [SOLVED] Replace data with the result of a formula
    By Jim K in forum Excel General
    Replies: 3
    Last Post: 12-08-2005, 09:54 AM
  7. How can I replace a formula with its result using a macro?
    By RAP in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 08-01-2005, 02:05 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