Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: Stop it calculating!

  1. #1
    New Member
    Join Date
    Apr 2002
    Posts
    12
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I have a piece of code that I just want to run when the sheet recalculates. However the code loops and I want it to stop as soon as it has finished the update. Any ideas... code below!!

    Private Sub Worksheet_Calculate()


    Sheets("Leaderboard").Activate
    Range("A4:C61").Select

    Selection.sort Key1:=Range("C5"), Order1:=xlDescending, Key2:=Range("B5") _
    , Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _
    False, Orientation:=xlTopToBottom

    End Sub


  2. #2
    MrExcel MVP
    Colo's Avatar
    Join Date
    Mar 2002
    Location
    Kobe, Japan
    Posts
    1,456
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    2 Thread(s)

    Default

    Hi,
    Try using "Application.EnableEvents"


    Private Sub Worksheet_Calculate()
    Application.EnableEvents = False
    Sheets("Leaderboard").Activate
    Range("A4:C61").Select

    Selection.Sort Key1:=Range("C5"), Order1:=xlDescending, Key2:=Range("B5") _
    , Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _
    False, Orientation:=xlTopToBottom
    Application.EnableEvents = True
    End Sub

    Hope this helps + pen pineapple apple pen!

    Masaru Kaji aka Colo - cellmasters.net

  3. #3
    New Member
    Join Date
    Apr 2002
    Posts
    12
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thanks

    I thought it should be quite simple.

    Regards

    Dobbo

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •