+ Reply to Thread
Results 1 to 12 of 12

Macro for running a macro when any cell in a range of cells changes

  1. #1
    Registered User
    Join Date
    07-29-2013
    Location
    India
    MS-Off Ver
    Excel 2002
    Posts
    53

    Wink Macro for running a macro when any cell in a range of cells changes

    Hello Experts,

    Greetings. I am thankfull for all the supports you provide. As usual, I need your support to generate a macro.

    I have Sheet1, in which Cells D14 to C20 are the targets. If any of these cells changes, I want to run the following macro.
    Please Login or Register  to view this content.
    Can you please help me. My sincere thanks for all experts.

    Should I paste your program in the Module / Worksheet or in the Workbook?

    Regards,
    gm2612
    Last edited by Leith Ross; 12-25-2013 at 03:22 AM. Reason: Added Code Tags

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Macro for running a macro when any cell in a range of cells changes

    Please Login or Register  to view this content.

    paste the code in the Worksheet module
    If solved remember to mark Thread as solved

  3. #3
    Registered User
    Join Date
    07-29-2013
    Location
    India
    MS-Off Ver
    Excel 2002
    Posts
    53

    Re: Macro for running a macro when any cell in a range of cells changes

    Hello patel45,

    Thanks for your timely support. But, I m getting error - Compile error / Expected: Identifier.

    When the code is pasted into the VB editor, the first line got hilighted with yellow.

    Can you please help me to resolve this? I am using excel 2003.

    Thanks and regards,
    gm2612

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Macro for running a macro when any cell in a range of cells changes

    Hi, gm2612,

    maybe drop the first Sub from what patel45 wrote?

    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  5. #5
    Registered User
    Join Date
    07-29-2013
    Location
    India
    MS-Off Ver
    Excel 2002
    Posts
    53

    Re: Macro for running a macro when any cell in a range of cells changes

    Hello Holger,

    Thanks for your help, ut still I am getting the same error.

    Can you please suggest solution?

    Thanks and regards,
    gm2612

  6. #6
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Macro for running a macro when any cell in a range of cells changes

    Hi, gm2612,

    as long as we donīt see your workbook I think itīs hard to get the reason for the error you mention. There may only be one Event of that name behind each sheet.

    Please check the attachment if itīs doing what you want it to do - if the changes are to be made via Formulas you should indicate this as I assumed this change to be via Entry/Edit directly into the target area. And the code will only work if one single cell inside the yellow area is altered.

    Ciao,
    Holger
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    07-29-2013
    Location
    India
    MS-Off Ver
    Excel 2002
    Posts
    53

    Re: Macro for running a macro when any cell in a range of cells changes

    Hello Holger,

    pardon me for not sending the workbook. I have attached it now. There are two sheets named OTD and Trend. I have given the information in the respective sheets. Can you please help me out?

    Thanks and regards,
    G.Manikandan

    Sample sheet for solving.xls
    Last edited by gm2612; 12-26-2013 at 12:05 AM. Reason: Adjust the position of attachment

  8. #8
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Macro for running a macro when any cell in a range of cells changes

    Hi, gm2612,

    you should add the logic of the worksheets as you want - there are formulas missing and the logic of percentages should be amended.

    Code goes behind worksheet OTD and will get triggered when any cell in the used range in Column E will be changed:
    Please Login or Register  to view this content.
    Ciao,
    Holger

  9. #9
    Registered User
    Join Date
    07-29-2013
    Location
    India
    MS-Off Ver
    Excel 2002
    Posts
    53

    Re: Macro for running a macro when any cell in a range of cells changes

    Dear Holger,

    Perfect. I am sorry that earlier I did not send you the full file. Now, the latest code you have provided by you WORKS PERFECT. Only one issue I have, that it is not sorting the data after pasting in cell C30 based on the top contributing factor, in descending order.

    Now, I have attached the xls spreadsheet to you. I humbly request you to kindly help me to resolve it. I think this is the last time I am appropaching you for this problem.

    It is apparent that I did not ask the question in correct manner. I just came to know about VBA codes and trying to use them to save my time and problems. I really appreciate your patience and helping nature.

    Thanks and regards,
    gm2612

    OTD Monitoring.xls

  10. #10
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Macro for running a macro when any cell in a range of cells changes

    Hi, gm2612,

    regarding the sorting: my bad, I just took the wrong area.

    Please Login or Register  to view this content.
    Again: your should check your formulas and sections, they might not meet with your requirements.

    Ciao,
    Holger

  11. #11
    Registered User
    Join Date
    07-29-2013
    Location
    India
    MS-Off Ver
    Excel 2002
    Posts
    53

    Re: Macro for running a macro when any cell in a range of cells changes

    My Dear Holger, I owe you Million Salutes for this help. Thank you soo much!

    Regarding your suggestion for reviewing the formulas and sections, can you please tell what exactly you mean? Because, objective of this project is to compile delivery performance data and put the reasons for failure in pareto and pie chart. So, I am thinking in one direction and I have none who will check the correctness of what I am doing. If you give me the details, I will check again and correct them.

    Many thanks for the help you are providing.

    Regards,
    gm2612

  12. #12
    Registered User
    Join Date
    07-29-2013
    Location
    India
    MS-Off Ver
    Excel 2002
    Posts
    53

    Re: Macro for running a macro when any cell in a range of cells changes

    Hello Holger, Yes, I have identified and corrected them. Thanks for the info again.

    Regards,
    gm2612

+ 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 hide/unhide cells not running or running slow
    By mbp727 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-17-2013, 04:22 PM
  2. Change range of cells within VBA macro and copy and paste to fixed cell range
    By Mannyny in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-20-2012, 11:51 AM
  3. Running macro when a paste action is detected in a specific range of cell
    By Skell in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-15-2012, 01:39 PM
  4. running a macro to copy multiple cells from a row by selecting a cell
    By Healthwatch in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 02-28-2009, 02:30 PM
  5. Running a macro if any data is entered in a range of cells
    By Jonathan in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-16-2005, 04:45 PM

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