Application.ScreenUpdating problem

G

Guest

Help!
Can't quite figure out why, but this code doesn't stop the screen from
updating. As it cycles through the For statement, the screen's updating.



Private Sub Workbook_Open()
Dim sh As Worksheet

Application.ScreenUpdating = False

For Each sh In ThisWorkbook.Worksheets
sh.Protect "unlock", , , userinterfaceonly:=True
sh.EnableSelection = xlUnlockedCells
Next sh

Worksheets("DataWorksheet").Visible = False
Worksheets("Information").Activate

'set page up for display
GoToForm

Application.ScreenUpdating = True

End Sub
 
G

Guest

I ran your code and found no screen updating during the run.
However, I was not able to select ANY cells including the unlocked ones.
since your code enables selection AFTER you have locked the sheets.

Moving sh.EnableSelection = xlUnlockedCells
to before the protect command solves this problem.
 
G

Guest

Thanks go. That helped with another problem I was having. I think I may have
found my screen updating problem, too.

I have a sheet_deactivate event on my first page that activates other sheets
and does stuff. I think what was happening was that as those sheets were
activating, they were changing the screenupdating to True. How? Dunno. But, I
put code in that allows me to check to see if the sheet_activate event comes
from another macro and then doesn't perform the sheet_activate event if it
does. Make sense?
 
G

Guest

Happens to me all the time til I insert
Application.EnableEvents=True
to turn off object change events out of the loop temporarily
then reverse the above code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Set Active Cell to A1 on Open Q 3
Only cells with values 3
Rename worksheets 3
Do 3 Tasks on Opening File Q 9
Protection Properties on WorkSheets 1
Code execution error 6
Runtime error - goto 6
Excel 2000 error 2

Top