+ Reply to Thread
Results 1 to 4 of 4

auto running a macro when a cell value changes

  1. #1
    Registered User
    Join Date
    08-30-2007
    Posts
    2

    auto running a macro when a cell value changes

    This is driving me nuts! It is mainly due to the fact that I am a new user to this. I have a workbook that contains several worksheets. I have the correct formulas in place, and I have created a Macro (Called Test_1) that seems to work so far. How ever I would like the Macro to run when cells G12 through G122, and H12 through H122 (these are on a work sheet named Inv.) have a value greater than 0. Or are changed from their current value. I have tried several times to get the VB code correct, but I just keep missing something. Any suggestions?

  2. #2
    Forum Contributor stevebriz's Avatar
    Join Date
    09-07-2006
    Location
    Santiago Chile
    Posts
    389
    somthing like this should work for you:

    Please Login or Register  to view this content.
    VBA - The Power Behind the Grid

    Posting a sample of your workbook makes it easier to look at the Issue.

  3. #3
    Registered User
    Join Date
    08-30-2007
    Posts
    2

    reply to code

    Thank you so much this is a giant leep into the right direction.

    This code "kinda" works. It actually causes a few more questions.
    1.Can you run a macro in the background so that you can't see it?

    2.Can you run this VB code on a column that has a formula? So that the variable can change without causing the macro to run, but when cells I12 through I122 change (these are the sum of G's and H's) it will cause the macro to run?

    3.When this code executes the macro it displays the last worksheet in the workbook. This can mess you up especially considering that you change the values, and therefore are looking at, the first worksheet in the workbook when the macro runs. Is there a way to stay on the first worksheet?

  4. #4
    Forum Contributor stevebriz's Avatar
    Join Date
    09-07-2006
    Location
    Santiago Chile
    Posts
    389
    1. Yes but..when you open the workbook it will come up with the secutiy waning..( eg:if xl is setup at medium it willask if you if you want to enable macros.

    To insert the code to run automatically insert it in the sheets code area.
    press ALT +F11 and then click on eg: sheet1 and paste the code in there.

    2. When it the target area in the macro is set eg:" I1:I112" then this macro only runs when a user changes the I1:I112 cells manually...Not by the fact that a formula changed the value.

    The formulas in column "I: will not be affected by the macro so they can remain.


    3.Put at the end of the macro
    Please Login or Register  to view this content.

+ 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