When you run this example, you can compare the respective running times, which are displayed in the message box. Screen Updating = True For i = 1 To 2 If i = 2 Then Application.
Screen Updating = False start Time = Time Worksheets("Sheet1").
Hopefully someone can come up with a reason for Screen Updating not taking effect when I open a new Workbook.
Enable Events = True End Sub There is quite a few redundancies in there as well as commented out lines that show various things I've tried. X settings to False, opened the Workbook, ran the macro, and closed.
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case. Screen Updating = True End If For j = 1 To 200000 ws. Finally I must add that those two Excel run on different machines: Excel 2010 with W7 and Excel 2013 with W8 I think that's all, for now you should avoid any code that selects or activates anything, work with fully qualified ranges instead of selection i believe that screenupdating can only be relied on to work correctly within the procedure it is called, if in doubt just put at the beginning of every procedure i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next Sub put Numbers In Cells() Dim ws As Worksheet Dim j As Long Dim resp As Integer Set ws = Active Sheet resp = Msg Box("Turn off updating? Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next dim previous Screen Update as boolean Call my Screen Update(False, previous Screen Update) 'to get the current setting into previous Screen Update Call my Screen Update(True, false) 'to set updating to false 'do your heavy code here and when finished: Call my Screen Update(True, previous Screen Update)maybe you have fiddled around with the code and thought the first "Call my Screen Update(True, previous Screen Update)" is useless/wrong?
Screen Updating = True Msg Box "done" End Sub Sub put Numbers In Cells() Dim ws As Worksheet Dim j As Long Dim resp As Integer Set ws = Active Sheet resp = Msg Box("Turn off updating? Screen Updating = previous Screen Update Else previous Screen Update = Application. Screen Updating = False End If End Sub And there I found that the first call (and the second too, I guess) was uneffective Can it be it's because of some maliciuos interaction between Application. But always remind that I get no flickering in Excel 2010.
Screen Updating = True End If For j = 1 To 200000 ws. So I put breaking points in every line code calling any "activate" method (cell, worksheet, workbook) checking for "? Screen Updating" in the immediate window and finding out that it was set to "True" even if I managed to set it to "False" before that "activate" call. Screen Updating setting, which follows Sub my Screen Update(screen Update Request As Boolean, previous Screen Update As Boolean) If screen Update Request Then Application. Since they get set in quite a mixed mode along the code: somtimes the former before the latter and sometimes in reverse.
The biggest problem I'm running into is that when I run the code (despite having Screen Updating set to False), it visibly opens the library file while it runs the macro.
To make sure this is efficient going forward, I want to prevent that from happening. Enable Events = False Dim bk As Workbook Dim result As Long Dim a WB As Workbook Dim a WS As Worksheet Set a WB = Active Workbook Set a WS = Active Workbook.
Also, wouldn't you want that function to contain the line Setting Screen Updating to false only prevents spreadsheet updates from showing. Although there are ways to hide the opening of a workbook, or access workbook data without creating an instance of Excel, for the task you're describing of creating a VBA library, the way to go about that is to create an Excel add-in.
Again, there is no Workbook_Open event that I know of. Further when I checked the This Workbook module in VBA, I didn't find any code there.
Close Set Destwb = Active Workbook ' do the stuff you want with this new workbook Destwb.