+ Reply to Thread
Results 1 to 9 of 9

Automatic running macros

  1. #1
    Registered User
    Join Date
    10-20-2019
    Location
    Bulgaria
    MS-Off Ver
    Microsoft office 365 pro plus
    Posts
    13

    Automatic running macros

    Hi guys,

    I have two separate macros that I want to run automatically. I have entered the script below (the first one is triggered by a change in B8 and the second one by a change in B21), however, it works for the first one only - the second one has to be run manually. Please help!

    Please Login or Register  to view this content.
    Thank you in advance!

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Automatic running macros

    The code looks ok to me.

    Welcome to the forum

    Please attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Registered User
    Join Date
    10-20-2019
    Location
    Bulgaria
    MS-Off Ver
    Microsoft office 365 pro plus
    Posts
    13

    Re: Automatic running macros

    Hi,

    Thanks for the reply.
    I am looking for the macro called "ExtendedPopulation" to run automatically when there is a change in cell B22.
    The macro called "HideRows" manages to run automatically when there is a change in B9 and I don't get why the code does not work for both.

    Please see the sample workbook attached.
    Attached Files Attached Files

  4. #4
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,410

    Re: Automatic running macros

    The problem is cell B22 is not changing... it is a formula and, as such, doesn't change... what it does do is display a result when one of the cells in the range G32:G56 change. So, your code needs to monitor those cells for changing and call your macro when they do.

  5. #5
    Registered User
    Join Date
    10-20-2019
    Location
    Bulgaria
    MS-Off Ver
    Microsoft office 365 pro plus
    Posts
    13

    Re: Automatic running macros

    Yes, I just figured that out myself. However not all changes to the cells in the range G32:G56 trigger a change in B22. Is there a way to trigger the macro if the value in B22 changes as a result from the formula?

    Thank you!

  6. #6
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,410

    Re: Automatic running macros

    I think you have to handle that in your macro. I am guessing your macro does one thing if B22 contains "Yes" and something else if not... if one of G32:G56 triggers a call to the macro, the macro can simply hide rows that are already hidden or unhide visible rows over again and the user won't see any change.

  7. #7
    Registered User
    Join Date
    10-20-2019
    Location
    Bulgaria
    MS-Off Ver
    Microsoft office 365 pro plus
    Posts
    13

    Re: Automatic running macros

    Thank you for your answer. How can I make the macro hide/unhide the rows in question when a cell in the range G32:G56 is made to contain "Fail". Also how do I make it do that automatically? I am having trouble configuring it.

    Thanks in advance!

  8. #8
    Registered User
    Join Date
    10-20-2019
    Location
    Bulgaria
    MS-Off Ver
    Microsoft office 365 pro plus
    Posts
    13

    Re: Automatic running macros

    Hi guys,

    I figured it out! It allows the change in the result from the formula in B22 to trigger the macro. Here is the answer:

    Please Login or Register  to view this content.
    Thanks all for helping me!

  9. #9
    Registered User
    Join Date
    07-21-2019
    Location
    Florida
    MS-Off Ver
    2016
    Posts
    9

    Re: Automatic running macros

    Had a similar issue. Wound up using seperate sheets and copying back and forth. But this looks great and simpler!

+ 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. All Macros Are Enabled, But Macros Are Still Not Running
    By chasfh in forum Excel Programming / VBA / Macros
    Replies: 24
    Last Post: 06-04-2019, 07:23 AM
  2. [SOLVED] Two macros are running separately but they are not running at once
    By RavindraK in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 07-18-2018, 11:51 PM
  3. [SOLVED] Event Driven Macros stop running after running a routine macro
    By ChemistB in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-18-2017, 12:34 PM
  4. [SOLVED] Hiding the file when running macros and after running macros
    By thilag in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-10-2016, 07:15 AM
  5. Automatic Running Macro
    By titanxt in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-22-2008, 01:57 AM
  6. Automatic running of Macros
    By praveen_khm in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-20-2006, 06:45 AM
  7. using automatic macros or object macros
    By Momo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-08-2005, 02:06 PM

Tags for this Thread

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