+ Reply to Thread
Results 1 to 16 of 16

Need help running a background macro for my whole sheet

  1. #1
    Registered User
    Join Date
    01-13-2019
    Location
    Virginia
    MS-Off Ver
    2016
    Posts
    9

    Need help running a background macro for my whole sheet

    I am trying to have my worksheet update the cell below the cell selected, based off what is in the cell. I have it figured out and working for one cell is there a what to do this with out writing the same code over and over again, I am pretty new to VBA and this is built off of a bunch of code searching:

    Please Login or Register  to view this content.
    I tried updating the range to include all the cells I want to accomplish this for with no luck. Any help would be great! thanks in advance
    Last edited by scalise; 01-13-2019 at 12:36 PM. Reason: Compliance to the rules

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

    Re: Need help running a background macro for my whole sheet

    On the face of it your requirement is simple.

    However no-one can help you.

    Please insert the code tags so we can help.


    Your post does not comply with Rule 2 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Click on Edit to open your thread, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 6)
    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
    01-13-2019
    Location
    Virginia
    MS-Off Ver
    2016
    Posts
    9

    Re: Need help running a background macro for my whole sheet

    Fixed,

    apologies for the oversight.

    -scalise

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

    Re: Need help running a background macro for my whole sheet

    Ok.

    You have pasted two codes do you need them both?

    The workbook activate code and the Change Code?

    Also what addresses are you interested in or is it all of them?

  5. #5
    Registered User
    Join Date
    01-13-2019
    Location
    Virginia
    MS-Off Ver
    2016
    Posts
    9

    Re: Need help running a background macro for my whole sheet

    This was based off my findings in another forum that the first one runs when the sheet is activated and the second one whenever there is a change. If this isn't needed I can keep just the change one but I would like it to run continuously in the background, again pretty new with VBA so not sure if this is the best way to accomplish my above goal. There are multiple sheets that all need the same logic applied so if there is a way to have it apply to all addresses that would be great, if not then for most of the sheets it D15:Q96.
    Last edited by scalise; 01-13-2019 at 12:51 PM.

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

    Re: Need help running a background macro for my whole sheet

    This code works on all cells on a single sheet:

    Right Click On Your Sheet Name At the Bottom Of Excel and Select View Code
    Paste this code in the module that opens and close it.

    Please Login or Register  to view this content.

    With a couple of small changes the Macro will work on all worksheets.

    Delete the Original Macro

    Select the developer tab
    Select view and then project explorer
    Select your project
    Double Click on ThisWorkbook
    Paste this code in the module that opens and close it.



    Please Login or Register  to view this content.
    Last edited by mehmetcik; 01-13-2019 at 01:00 PM.

  7. #7
    Registered User
    Join Date
    01-13-2019
    Location
    Virginia
    MS-Off Ver
    2016
    Posts
    9

    Re: Need help running a background macro for my whole sheet

    It worked one time, but being a silly newbie I should have mentioned that this a form a user fills out and resets once they are done using a macro, which clears the user entered data. Is there a way to have it run even if the user clears the form?

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

    Re: Need help running a background macro for my whole sheet

    Firstly:

    Adding this code to the "ThisWorkbook" module will update D16 each time you select a worksheet.

    Please Login or Register  to view this content.
    Secondly:

    Not sure what you are asking. The Macro will continue to run as long as events are eabled.

    If a Macro is used to clear the workbook. Then add this line to the end of that macro,


    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    01-13-2019
    Location
    Virginia
    MS-Off Ver
    2016
    Posts
    9

    Re: Need help running a background macro for my whole sheet

    See attached template example.
    Attached Files Attached Files
    Last edited by scalise; 01-13-2019 at 01:24 PM. Reason: adding attachment

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

    Re: Need help running a background macro for my whole sheet

    Edit your post. Click on Advanced at the bottom, then click om Manage attachments

  11. #11
    Registered User
    Join Date
    01-13-2019
    Location
    Virginia
    MS-Off Ver
    2016
    Posts
    9

    Re: Need help running a background macro for my whole sheet

    See Above Edited post, again thank you!

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

    Re: Need help running a background macro for my whole sheet

    You must start your clear Macro with

    Please Login or Register  to view this content.
    This will stop macros running while you clear the cells

    Please Login or Register  to view this content.

    Does this Version of Reset work?

    Please Login or Register  to view this content.
    Last edited by mehmetcik; 01-13-2019 at 01:57 PM.

  13. #13
    Registered User
    Join Date
    01-13-2019
    Location
    Virginia
    MS-Off Ver
    2016
    Posts
    9

    Re: Need help running a background macro for my whole sheet

    Okay that's done, but I am still not getting any text out values in the offset in the sheet anymore.

  14. #14
    Registered User
    Join Date
    01-13-2019
    Location
    Virginia
    MS-Off Ver
    2016
    Posts
    9

    Re: Need help running a background macro for my whole sheet

    No it still wont play the worksheet macro it only ran that one time which is weird because anytime I make a change to the sheet it should run.

  15. #15
    Registered User
    Join Date
    01-13-2019
    Location
    Virginia
    MS-Off Ver
    2016
    Posts
    9

    Re: Need help running a background macro for my whole sheet

    FIXED it has been solved, Newbie Error... it was the code you posted for the workbook instead of the sheet inside my sheet I pasted the wrong thing... Thank you so much for this, now I only have 20 workbooks to apply this to.. fun times ahead!

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

    Re: Need help running a background macro for my whole sheet

    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)

Similar Threads

  1. How to Use Ctrl-Y (F4) Feature During Macro Running in Background?
    By vbaxcel in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-10-2017, 05:03 AM
  2. Running Macro in Background (Excel)
    By Ernieballzbass in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-24-2015, 02:07 PM
  3. How to show a Progress bar while macro is running in background?
    By pradeepjassal in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-20-2015, 07:47 PM
  4. Replies: 8
    Last Post: 03-09-2012, 12:25 PM
  5. Macro/Module running as background process, copy data from sheet to sheet
    By ctor in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-05-2009, 05:48 AM
  6. macro running in background
    By mjk1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-03-2008, 09:30 AM
  7. running macros in the background
    By Griffp in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-12-2008, 03:02 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