Consulting

Results 1 to 9 of 9

Thread: screenupdating error

  1. #1
    VBAX Tutor
    Joined
    Oct 2007
    Posts
    210
    Location

    screenupdating error

    when i try to run the following code:
    Application.ScreenUpdating = False
    Application.GoTo Reference:=Worksheets("Master Log").Range("A1")
    It shows the Master Log sheet. When I trace this program and stop on the second line applicaton.screenupdating still equals TRUE. Please help
    Last edited by Aussiebear; 03-29-2023 at 06:17 PM. Reason: Adjusted the code tags
    "The amount of stupid people in the world is God's way of punishing the smart people" - protean_being

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Okay, then try this

    [vba]

    Application.ScreenUpdating = False
    Debug.Print Application.ScreenUpdating
    Application.Goto Reference:=Worksheets("Master Log").Range("A1")
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Tutor
    Joined
    Oct 2007
    Posts
    210
    Location
    Debug shows it as False.
    "The amount of stupid people in the world is God's way of punishing the smart people" - protean_being

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Exactly! So what do you deduce from that?
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    VBAX Tutor
    Joined
    Oct 2007
    Posts
    210
    Location
    That something is overriding the value (or superceding it)
    "The amount of stupid people in the world is God's way of punishing the smart people" - protean_being

  6. #6
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Well yes in a way.

    If you turn off ScreenUpdating, contrary to what Help says, when the procedure completes, it is back on again. That is, when Excel takes back control, Screenupdating is automatically turned on.

    So my reading is that if you interrupt code to do something that involves the screen then Excel takes over and Screenupdating is restored
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  7. #7
    VBAX Tutor
    Joined
    Oct 2007
    Posts
    210
    Location
    Yes but when I step through the program, hover the cursor over application.screenupdating is shows TRUE immediately after the line
    application.screenupdating = FALSE
    Last edited by Aussiebear; 03-29-2023 at 06:18 PM. Reason: Adjusted the code tags
    "The amount of stupid people in the world is God's way of punishing the smart people" - protean_being

  8. #8
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Because steepping through and hovering causes screen interaction, hence it needs to make updating available to show you the values. That was exactly the point I was driving at.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  9. #9
    VBAX Tutor
    Joined
    Oct 2007
    Posts
    210
    Location
    so your saying that breaking the program caused screenupdating to revert back to TRUE?
    "The amount of stupid people in the world is God's way of punishing the smart people" - protean_being

Posting Permissions

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