Screen refresh problem

  • Thread starter Thread starter Alex St-Pierre
  • Start date Start date
A

Alex St-Pierre

Hi!
When I change a value inside a worksheet, I see the contents of an other
sheet inside the activesheet. Then, when I scroll with the mouse, it
disapears. Does anyone have an idea?
Thank you!
 
No, it's not a change_event macro. I found a part of the problem.
When I open the document, all work fine. I can delete a sheet without having
screen updating problem. Then, after running abc, if I delete a sheet or
change a value, I see the same thing (part of the content of an other sheet).
Do you have an idea?
Thank you!
Alex
Sub abc()
Call ProtectSheet(False)
Call ProtectSheet(True)
End Sub
Sub ProtectSheet(bValue As Boolean)
If bValue = True Then
ThisWorkbook.sheets("data").Protect DrawingObjects:=True,
Contents:=True, Scenarios:=True
ThisWorkbook.sheets("A-1").Protect DrawingObjects:=True,
Contents:=True, Scenarios:=True
ThisWorkbook.sheets("A-2").Protect DrawingObjects:=True,
Contents:=True, Scenarios:=True
ThisWorkbook.sheets("A-3").Protect DrawingObjects:=True,
Contents:=True, Scenarios:=True
ThisWorkbook.sheets("A-4").Protect DrawingObjects:=True,
Contents:=True, Scenarios:=True
ThisWorkbook.sheets("A-5").Protect DrawingObjects:=True,
Contents:=True, Scenarios:=True
ThisWorkbook.sheets("A-6").Protect DrawingObjects:=True,
Contents:=True, Scenarios:=True
ThisWorkbook.sheets("A-7").Protect DrawingObjects:=True,
Contents:=True, Scenarios:=True
Else
ThisWorkbook.sheets("data").Unprotect
ThisWorkbook.sheets("A-1").Unprotect
ThisWorkbook.sheets("A-2").Unprotect
ThisWorkbook.sheets("A-3").Unprotect
ThisWorkbook.sheets("A-4").Unprotect
ThisWorkbook.sheets("A-5").Unprotect
ThisWorkbook.sheets("A-6").Unprotect
ThisWorkbook.sheets("A-7").Unprotect
End If
End Sub
 
I would have written the code a bit differently but

try
application.screenupdating=false
code
application.screenupdating=true

Don Guillett
Microsoft MVP Excel
SalesAid Software
(e-mail address removed)
 
It happens when I unprotect a specific sheet and it's always the content of
this sheet that we see inside other sheet.
 
No, it doesnt' work with application.screenupdating=false.

Since it's only one sheet that have the problem, maybe, the only thing I
see is:
1) Same thing happens with another computer
2) Can it be a variable Set abc = that is not reset at the end? (no global
variable is used) When I close the file, I thought all variable or object
information are lost).
3) I use Image in each sheets that execute a macro when you click on it.
(Image_1_Click(), Image_2_Click()). I had this programmation for a while
without having problem.
4) There's no hidden row or column.

I think the only solution is to copy the file and try to find the solution
by 1) remove all the macros from the file 2) Remove image, 3)Remove other
sheets, etc. until it works!
 
Thank you Don!
This is exactly the problem I describe.
KB973593:
The problem is due to some change in
functionality to the Application.Screenupdating function
upon further review of my code I found out that the issue is caused by
unprotecting / protecting non-active sheets in the workbook.
I'll try the workaround and see if it can solve it.
Alex
 
Try hotfix (KB978908). It worked like a charm for me despite the Microsoft disclaimer:

"This hotfix has not undergone full testing. Therefore, it is intended only for systems or computers that are experiencing the exact problem that is described in the one or more Microsoft Knowledge Base articles that are listed in "KB Article Numbers" field in the table at the end of this e-mail message. If you are not sure whether any special compatibility or installation issues are associated with this hotfix, we encourage you to wait for the next service pack release. The service pack will include a fully tested version of this fix. We understand that it can be difficult to determine whether any compatibility or installation issues are associated with a hotfix. If you want confirmation that this hotfix addresses your specific problem, or if you want to confirm whether any special compatibility or installation issues are associated with this hotfix, support professionals in Customer Support Services can help you with that."

You will have to request the hotfix from Microsoft. They will send you a link to the file as well as a password with which to open it. From there on it is self explanatory.
 
Back
Top