+ Reply to Thread
Results 1 to 10 of 10

How to have a macro continuously running?

  1. #1
    Registered User
    Join Date
    11-17-2020
    Location
    UK
    MS-Off Ver
    2016
    Posts
    21

    How to have a macro continuously running?

    Hello all,
    I hope to find you well.

    I'm having a problem with a macro that I'm using in a excel questionnaire. Everything works ok when I follow the "correct" order of filling the questionnaire.

    However, when I change the cell D10 after selecting the option in H20, the Check Box 5 and Check Box 6 appear again (even when "NO" is already selected).

    For example: I have insered a code, then I have selected "NO" and then I have change the code to 300. As you can see, the checkboxes appeared again. If I select "NO" again, the checkboxes disappear again.
    one.JPG

    Also, when I open the Excel file and it is selected "NO", the checkboxes appear.

    I've attached the workbook.


    Thank you a lot, again!
    Attached Files Attached Files
    Last edited by AliGW; 01-20-2022 at 10:40 AM.

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,815

    Re: How to have a macro continuously running?

    Rather than trying to decipher your code, which contains several macros, could you explain in detail, step by step, what you want to do referring to specific cells, rows, columns and sheets using a few examples from your data? It may also be possible to use only one macro.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  3. #3
    Registered User
    Join Date
    10-23-2020
    Location
    Kentucky
    MS-Off Ver
    2016
    Posts
    24

    Re: How to have a macro continuously running?

    This will do what your asking but im not sure that this is what your actually wanting

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    11-17-2020
    Location
    UK
    MS-Off Ver
    2016
    Posts
    21

    Re: How to have a macro continuously running?

    Quote Originally Posted by Mumps1 View Post
    Rather than trying to decipher your code, which contains several macros, could you explain in detail, step by step, what you want to do referring to specific cells, rows, columns and sheets using a few examples from your data? It may also be possible to use only one macro.
    Hello,

    Sorry, I thought that this way it would be easier.

    So, in my code I have two "macros": one that hides specific rows and checkboxes (rows 31,32,33 and 34), depending on the cell D10. If the cell D10 is 100 or 200, row 32 is hidden and CheckBox2 is hidden; if cell D10 is 300 or 400, rows 33 and 34 are hidden and checkbox3 and checkbox4 are hidden; and so on.
    Cell D10:

    Attachment 705874

    Attachment 705875


    This is what I have in the first part of the code.

    Please Login or Register  to view this content.
    Then, the cell H20 can be "YES" or "NO".

    Attachment 705876

    What the second part of the code does is that if H20 is "YES", row 21 and 22, Check Box 5 and Check Box 6 are showed and if it is "NO", rows 21 and 22 , Check Box 5 and Check Box 6 are hidden, which is this part of my second code:

    Please Login or Register  to view this content.
    The problem of my code is that, if I select the cell H20 to "NO" (which will result in rows 21 and 22 hidden and Check Box 5 and Check Box 6 are hidden) and then change the D10 to another option, the Check Box 5 and Check Box 6 will appear again.

    Attachment 705877
    Attachment 705878

    What I want would be that, even if I change the cell D10, but H20 is "NO", Check Box 5 and Check Box 6 would still hidden. Maybe for that the macro needs to be run continuously(?)

    Thank you!

  5. #5
    Registered User
    Join Date
    11-17-2020
    Location
    UK
    MS-Off Ver
    2016
    Posts
    21

    Re: How to have a macro continuously running?

    Quote Originally Posted by mthroesch View Post
    This will do what your asking but im not sure that this is what your actually wanting

    Please Login or Register  to view this content.
    Hello!

    That's the code that I already have. The problem of my code is that, if I select the cell H20 to "NO" (which will result in rows 21 and 22 hidden and Check Box 5 and Check Box 6 are hidden) and then change the D10 to another option, the Check Box 5 and Check Box 6 will appear again.


    Thank you.

  6. #6
    Registered User
    Join Date
    10-23-2020
    Location
    Kentucky
    MS-Off Ver
    2016
    Posts
    24

    Re: How to have a macro continuously running?

    the code that i put earlier will replace the macros. look at this file and tell me if it does what you are looking for
    Attached Files Attached Files
    Last edited by AliGW; 01-20-2022 at 10:41 AM.

  7. #7
    Registered User
    Join Date
    10-23-2020
    Location
    Kentucky
    MS-Off Ver
    2016
    Posts
    24

    Re: How to have a macro continuously running?

    this code also fixes the checkbox being made visible that was showing up when you selected 300

  8. #8
    Registered User
    Join Date
    10-23-2020
    Location
    Kentucky
    MS-Off Ver
    2016
    Posts
    24

    Re: How to have a macro continuously running?

    Quote Originally Posted by caet_ View Post
    Hello!

    That's the code that I already have. The problem of my code is that, if I select the cell H20 to "NO" (which will result in rows 21 and 22 hidden and Check Box 5 and Check Box 6 are hidden) and then change the D10 to another option, the Check Box 5 and Check Box 6 will appear again.


    Thank you.
    so if you look in the code i posted it combines all your other code including your H20 and D10 Options so that if H20 is no then no matter what D10 equals rows 21 and 22 will stay hidden.

  9. #9
    Registered User
    Join Date
    10-23-2020
    Location
    Kentucky
    MS-Off Ver
    2016
    Posts
    24

    Re: How to have a macro continuously running?

    you could go with a user form that might work better for what you are wanting to do with a questionnaire and have that save the info from the userform to the spreadsheet. and just have excel open the userform on open of excel file

  10. #10
    Registered User
    Join Date
    11-17-2020
    Location
    UK
    MS-Off Ver
    2016
    Posts
    21

    Re: How to have a macro continuously running?

    Quote Originally Posted by mthroesch View Post
    the code that i put earlier will replace the macros. look at this file and tell me if it does what you are looking for
    You are right! It worked.

    Thank you very much, you made my day!

+ 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. Continuously Running Macro That Executes when I Left Click
    By TheMechEngineer in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-02-2019, 03:59 PM
  2. [SOLVED] How to stop a call macro from continuously running
    By Teblol in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-21-2016, 04:21 PM
  3. Continuously Running Macro
    By jakeamus in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-03-2015, 04:31 PM
  4. Replies: 10
    Last Post: 02-12-2014, 04:14 AM
  5. How to Stop IF Statement running continuously?
    By Jardman123 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-04-2013, 09:45 PM
  6. Macro running continuously
    By billpurdom in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-07-2013, 12:29 PM
  7. Continuously running a recorded macro-Please Help
    By Nik.Kaps in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-10-2012, 07:27 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