+ Reply to Thread
Results 1 to 3 of 3

Running a macro automatically when a cell with an IF formula changes.

  1. #1
    Registered User
    Join Date
    05-15-2013
    Location
    New Delhi, India
    MS-Off Ver
    Excel 2007
    Posts
    32

    Running a macro automatically when a cell with an IF formula changes.

    Hi,

    New to VBA. Have a worksheet where cell A2 is has an IF formula which gives value as either 0 or 1, depending on the value in cell B2 which is a data validation cell. I want my macro to run everytime the value in cell A2 changes. Can someone please post a code to help me out? Thanks!

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,653

    Re: Running a macro automatically when a cell with an IF formula changes.

    You can automatically run a macro when the user (not a formula) changes a cell value. Since the user is changing cell B2, try something like this.
    • Right-click on the worksheet tab with the A2:B2 cells
    • Select View Code from the pop-up context menu
    • Paste the code below in the worksheet's code module
    • Change the name of MyMacro to the name of your macro
    Please Login or Register  to view this content.
    Your macro can then test the value of the IF formula in A2.
    Last edited by AlphaFrog; 05-15-2013 at 01:31 AM.

  3. #3
    Registered User
    Join Date
    05-15-2013
    Location
    New Delhi, India
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: Running a macro automatically when a cell with an IF formula changes.

    Thanks

+ 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