+ Reply to Thread
Results 1 to 8 of 8

Trigger code when I calc

Hybrid View

aresquare1 Trigger code when I calc 04-14-2015, 06:26 PM
TMS Re: Trigger code when I calc 04-14-2015, 06:32 PM
aresquare1 Re: Trigger code when I calc 04-15-2015, 08:48 AM
TMS Re: Trigger code when I calc 04-15-2015, 10:02 AM
aresquare1 Re: Trigger code when I calc 04-16-2015, 10:20 AM
TMS Re: Trigger code when I calc 04-16-2015, 10:27 AM
aresquare1 Re: Trigger code when I calc 04-17-2015, 07:39 AM
TMS Re: Trigger code when I calc 04-17-2015, 08:04 AM
  1. #1
    Forum Contributor
    Join Date
    04-15-2008
    Location
    Texas, USA
    MS-Off Ver
    M365 Excel Version 2210
    Posts
    216

    Trigger code when I calc

    If I have a sheet the I ONLY manually calc, how can I get some code to run right after I do a Shift+Calc? I have a very long matrix that is filtered. I'd like to refresh the filter after I calc. I have the code to refresh the filter. It runs every time I select the sheet but I'd also like to run it every time I calc.

    Thanks for your help.
    RR

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,052

    Re: Trigger code when I calc

    Maybe use:

    Private Sub Worksheet_Calculate()
    
    End Sub

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor
    Join Date
    04-15-2008
    Location
    Texas, USA
    MS-Off Ver
    M365 Excel Version 2210
    Posts
    216

    Re: Trigger code when I calc

    What I'm looking for is this. The code below (I think) refreshes the filter in B25 every time I move to this sheet. If, however, I manually calculate and do not move off this sheet, the filter need refreshing. I was hoping to get some code that ran the filter refresh below every time I recalculate this sheet instead of when I select this page.

    Private Sub Worksheet_Activate()
    Application.ScreenUpdating = False


    ' Refreshes that Filter in Col A so that all rows show
    ActiveSheet.Range("$B$25:$W$6046").AutoFilter Field:=1

    ' Refreshes that Filter in Col A so that JUST the Zeros show and not the 1's which represent blank output
    ActiveSheet.Range("$B$25:$W$6046").AutoFilter Field:=1, Criteria1:="-"

    Application.ScreenUpdating = True
    Range("A1").Select
    End Sub

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,052

    Re: Trigger code when I calc

    Copy and paste the code you have in the sheet activate event handler into the sheet calculate event handler. You probably won't need the sheet activate event handler.

  5. #5
    Forum Contributor
    Join Date
    04-15-2008
    Location
    Texas, USA
    MS-Off Ver
    M365 Excel Version 2210
    Posts
    216

    Re: Trigger code when I calc

    Do that by doing this?

    Replace Private Sub Worksheet_Activate()

    With this Private Sub Worksheet_Calculate()

    And if I do that, every time I calculate, it runs the refresh code?

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,052

    Re: Trigger code when I calc

    And if I do that, every time I calculate, it runs the refresh code?
    Yes ...

  7. #7
    Forum Contributor
    Join Date
    04-15-2008
    Location
    Texas, USA
    MS-Off Ver
    M365 Excel Version 2210
    Posts
    216

    Re: Trigger code when I calc

    Outstanding!!!

    Thanks for your help.
    Have a great day in "The Great City of Manchester" from The Great State of Texas

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,052

    Re: Trigger code when I calc

    You're welcome.



    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

+ 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. Inputs to trigger VBA code
    By kal46 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-28-2016, 02:23 PM
  2. Adjust a code from cell range trigger to button trigger
    By ld2x07 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-01-2014, 10:02 AM
  3. [SOLVED] Trigger Code by Dropdown
    By rachaelgoldman1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-07-2013, 10:31 AM
  4. Allow code to run once then not until it's trigger value appears again
    By ozhunter in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-18-2013, 08:04 AM
  5. How to trigger code execution?
    By alwaysgo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-11-2008, 09:11 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