none
screenupdating is been reset RRS feed

  • Question

  • Hi

    I got into a strange behavior with the application.Screenupdating property

    Here is pasted direct from my VB console. I got a similar behavior from Visual Studio VB

    application.screenupdating=False:?application.ScreenUpdating
    Faux
    ?application.ScreenUpdating
    Vrai

    is the Screenupdating property been reset automatically ?

    Sunday, June 3, 2018 5:12 PM

Answers

  • Hello JMB1502,

    Printing the ScreenUpdating on first line is to check if the value is reset to true while second time to run the code.

    In my test, the reset only occurs after finishing the whole macro call. So once you set it as false, it will keep false until finishing the macro. I think there is no need to remain the state.

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    • Edited by Terry Xu - MSFT Wednesday, June 6, 2018 6:15 AM
    • Marked as answer by JMB1502 Wednesday, June 6, 2018 6:22 AM
    Wednesday, June 6, 2018 6:15 AM

All replies

  • Hello JMB1502,

    >>

    application.screenupdating=False:?application.ScreenUpdating
    Faux
    ?application.ScreenUpdating
    Vrai

    I do fail to read the code. Is there any typo or the page mess up your code? Could you code run successfully?

    I would suggest you try to use the "Insert  Code Block" icon on the top of the reply editor or share a screenshot of your code to let us know the correct code in your project.

    Besides, what do you mean "reset"?

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, June 4, 2018 6:19 AM
  • Hi thanks for the interest

    What you see is not code, these are commands (and their response) type in the VB console of Excel.

    In my code, when I saw that setting screenupdating property to false did not perform as expected, I checked its value in Excel itself and I saw it = True.

    I then tried a few commands in the VB console of Excel, and came up with what you see
    Monday, June 4, 2018 8:42 AM
  • Hello JMB1502,

    I think I got known your operation and I could reproduce it. I enter "application.screenupdating=False:?application.ScreenUpdating" in immediate window and it return false. And then I enter "?application.ScreenUpdating", it returns true. 

    And I also tried to run then in a macro.

    Sub Test()
    Debug.Print Application.ScreenUpdating
    Application.ScreenUpdating = False
    Debug.Print Application.ScreenUpdating
    End Sub
    

    It will always print True and then False every time to run. 

    Based on these, I think Screenupdating property is automatically reset to true.

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, June 4, 2018 9:43 AM
  • Thanks very much for confirming.

    I think in the Test macro you should set ScreenUpdating to false on the first line. As it is, only on the second call ilt will answer true, false

    But of course I want not to update the screen when running macros that modify heavily the cell appearances. So I would like to keep it to False until I have finished.

    So do you think there is a way for the screenupdating flag to remain false while my macros update excel ? Of course at the end of my macros I set screenupdating to true

    Tuesday, June 5, 2018 9:16 AM
  • Hello JMB1502,

    Printing the ScreenUpdating on first line is to check if the value is reset to true while second time to run the code.

    In my test, the reset only occurs after finishing the whole macro call. So once you set it as false, it will keep false until finishing the macro. I think there is no need to remain the state.

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    • Edited by Terry Xu - MSFT Wednesday, June 6, 2018 6:15 AM
    • Marked as answer by JMB1502 Wednesday, June 6, 2018 6:22 AM
    Wednesday, June 6, 2018 6:15 AM