+ Reply to Thread
Results 1 to 15 of 15

automatically-execute-an-excel-macro-on-a-cell-change

  1. #1
    Forum Contributor
    Join Date
    07-01-2012
    Location
    ZA
    MS-Off Ver
    Excel 2013
    Posts
    300

    automatically-execute-an-excel-macro-on-a-cell-change

    I have data in column B2-B77 ...I have this macro but I dont know how to make it work with my code....If any value in this range B2-B77 change it must automatically run a macro I have named "History". Rep given for a fundi for the code to make it work -here is the code. My workbooks name is Monday and the sheets name is Seq


    Thank you

    Please Login or Register  to view this content.
    Last edited by ricklou; 12-17-2016 at 05:39 AM.

  2. #2
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: automatically-execute-an-excel-macro-on-a-cell-change

    Use the Worksheet Change event in the worksheet class module this is to apply to

    Please Login or Register  to view this content.
    Your example is a little vague - is that the code for History or the code you assume goes somewhere to call History? I'm assuming you want to pass the changed cell to the procedure.

    This other thing, not mentioned, is this will only work for manual changes, not changes resulting from formula recalcs.
    Last edited by cytop; 12-17-2016 at 05:48 AM.

  3. #3
    Forum Contributor
    Join Date
    07-01-2012
    Location
    ZA
    MS-Off Ver
    Excel 2013
    Posts
    300

    Re: automatically-execute-an-excel-macro-on-a-cell-change

    Quote Originally Posted by cytop View Post
    Use the Worksheet Change event in the worksheet class module this is to apply to



    Your example is a little vague - is that the code for History or the code you assume goes somewhere to call History? I'm assuming you want to pass the changed cell to the procedure.
    Hi no this code is not in the macro history.....it must only call a macro "History" in my worksheet Monday sheet Seq if any value in the same worksheet changes value -range B2-B77. Hope this more clear now. Thanks for your response

  4. #4
    Forum Contributor
    Join Date
    07-01-2012
    Location
    ZA
    MS-Off Ver
    Excel 2013
    Posts
    300

    Re: automatically-execute-an-excel-macro-on-a-cell-change

    Quote Originally Posted by cytop View Post
    Use the Worksheet Change event in the worksheet class module this is to apply to

    Please Login or Register  to view this content.
    This dont work NB History is already a macro I have) If the values in that range change it must call macro History
    Last edited by ricklou; 12-17-2016 at 06:06 AM.

  5. #5
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: automatically-execute-an-excel-macro-on-a-cell-change

    That works, subject to what was mentioned in the last comment of my first post, and it has been tested.

    So saying "This dont work" is pointless unless you explain what you did, where you added the code and any other information you think might be relevant.

  6. #6
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,357

    Re: automatically-execute-an-excel-macro-on-a-cell-change

    And what does your macro History look like???
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  7. #7
    Forum Contributor
    Join Date
    07-01-2012
    Location
    ZA
    MS-Off Ver
    Excel 2013
    Posts
    300

    Re: automatically-execute-an-excel-macro-on-a-cell-change

    Quote Originally Posted by cytop View Post
    That works, subject to what was mentioned in the last comment of my first post, and it has been tested.

    So saying "This dont work" is pointless unless you explain what you did, where you added the code and any other information you think might be relevant.
    Put your macro in as a new macro. Wento to the sheet and changed B2 from 0 to 1 it did not run macro History

  8. #8
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: automatically-execute-an-excel-macro-on-a-cell-change

    Mentioned previously.

    Use the Worksheet Change event in the worksheet class module this is to apply to

  9. #9
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,357

    Re: automatically-execute-an-excel-macro-on-a-cell-change

    This is getting us nowhere. Post an example file with desensitized data and your macro History in it.

  10. #10
    Forum Contributor
    Join Date
    07-01-2012
    Location
    ZA
    MS-Off Ver
    Excel 2013
    Posts
    300

    Re: automatically-execute-an-excel-macro-on-a-cell-change

    Quote Originally Posted by bakerman2 View Post
    And what does your macro History look like???
    Here is the macro it must call......a simple copy paste operation where it delete 1 row. But thats defeating the point B2-B70 if any value there changes it must call it
    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    07-01-2012
    Location
    ZA
    MS-Off Ver
    Excel 2013
    Posts
    300

    Re: automatically-execute-an-excel-macro-on-a-cell-change

    Quote Originally Posted by cytop View Post


    Use the Worksheet Change event in the worksheet class module this is to apply to ??????

    Mentioned previously.
    where is this sorry I dont know where it is -I thought its a macro ????

  12. #12
    Forum Contributor
    Join Date
    07-01-2012
    Location
    ZA
    MS-Off Ver
    Excel 2013
    Posts
    300

    Re: automatically-execute-an-excel-macro-on-a-cell-change

    Quote Originally Posted by bakerman2 View Post
    This is getting us nowhere. Post an example file with desensitized data and your macro History in it.
    Confidential company info I cannot post 24mb file sorry.....just want a simple macro to be automatically run when the values in range change

  13. #13
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,357

    Re: automatically-execute-an-excel-macro-on-a-cell-change

    The problem is that your basic knowledge of VBA is to small.
    The code cytop provided is to be placed in Sheet module of sheet Seq.

    Please Login or Register  to view this content.
    Last edited by bakerman2; 12-17-2016 at 06:52 AM.

  14. #14
    Forum Contributor
    Join Date
    07-01-2012
    Location
    ZA
    MS-Off Ver
    Excel 2013
    Posts
    300

    Re: automatically-execute-an-excel-macro-on-a-cell-change

    Quote Originally Posted by bakerman2 View Post
    The problem is that your basic knowledge of VBA is to small.
    The code cytop provided is to be placed in Sheet module of sheet Seq.

    Please Login or Register  to view this content.
    sorry yes I am no VBA fundi sorry for that and the fact I cannot upload company confidential info dont help either....Sorry but your last one works like a charm thank you so much. Rep will be given to both of you

  15. #15
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,357

    Re: automatically-execute-an-excel-macro-on-a-cell-change

    You're welcome and thanks for adding rep points.

+ 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 execute based on a cell value change - if enter is not pressed
    By DJDRU in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-01-2016, 11:52 PM
  2. [SOLVED] Execute macro on cell value change
    By tom.mat.walker in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-15-2015, 05:14 AM
  3. Execute a Macro automatically
    By Stonebirds in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-12-2013, 06:24 PM
  4. Replies: 1
    Last Post: 04-10-2012, 03:21 AM
  5. Execute macro automatically after cell update
    By carlwin in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 12-19-2010, 08:56 PM
  6. On Cell change, execute macro
    By des_wes in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-19-2007, 07:01 PM
  7. [SOLVED] How to execute a macro automatically at startup of Excel?
    By Radim in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-29-2006, 07:00 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