+ Reply to Thread
Results 1 to 6 of 6

How to run a recorded macro when cell values change?

  1. #1
    Registered User
    Join Date
    06-11-2012
    Location
    USA
    MS-Off Ver
    Office 97
    Posts
    43

    How to run a recorded macro when cell values change?

    I have a recorded macro that I would like to run automatically when a range of cell values change (say "A1:A5"). How would I code this into VBA?

  2. #2
    Valued Forum Contributor StevenM's Avatar
    Join Date
    03-23-2008
    Location
    New Lenox, IL USA
    MS-Off Ver
    2007
    Posts
    910

    Re: How to run a recorded macro when cell values change?

    In your worksheet module, place the following code:

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    05-04-2012
    Location
    Stamford,Connecticut,USA
    MS-Off Ver
    Excel 2003
    Posts
    105

    Re: How to run a recorded macro when cell values change?

    http://www.ozgrid.com/VBA/vba-intersect.htmRead this:

  4. #4
    Registered User
    Join Date
    06-11-2012
    Location
    USA
    MS-Off Ver
    Office 97
    Posts
    43

    Re: How to run a recorded macro when cell values change?

    Quote Originally Posted by StevenM View Post
    In your worksheet module, place the following code:

    Please Login or Register  to view this content.
    Would "' do something here" be the macro name? I tried this code and it didn't work.

    Please Login or Register  to view this content.
    UpdateMash1 is the name of the recorded macro. I can run the macro via a button and it works, but I can't seem to get it to run automatically when the cells are updated. I'm finally finished with this sheet (thanks to your help with the loop) but now there's a glitch. Cells with formulas that should update automatically when data is entered into cell ranges "B23:H23" won't update unless I scroll out of view of the cells or double click the cells and press enter.

  5. #5
    Valued Forum Contributor StevenM's Avatar
    Join Date
    03-23-2008
    Location
    New Lenox, IL USA
    MS-Off Ver
    2007
    Posts
    910

    Re: How to run a recorded macro when cell values change?

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    06-11-2012
    Location
    USA
    MS-Off Ver
    Office 97
    Posts
    43

    Re: How to run a recorded macro when cell values change?

    Quote Originally Posted by StevenM View Post
    Please Login or Register  to view this content.
    You've done it agian. Thank you Sir!!! Works perfectly. I found another trick while I was googling coding solutions for this. I used Application.ScreenUpdating to eliminate the screen flickering. Now it's like the glitch never happened. Here's the finished code.

    Please Login or Register  to view this content.
    Thanks again for all your help.

    Cheers

+ 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