Stopped flicker, added protection and it started again HELP

RobbieNZ

New Member
Joined
Aug 17, 2010
Messages
21
Hi,

I have this macro which hides rows based on the results in other cells.
All works fine, had to add Application.ScreenUpdating = False/ and True to stop the page flickering each time a validation box was selected BUT then i went to complete the project by protecting the sheets and two things happend. First I got a
Runtime error 1004

I looked around the internet to find a solution to the error so added an umprotect command to the start and a protect command to the end of the macro so it would use my protection password to unlock and relock the page after running the macro. Unfortunately now I have the flicker back and can't understand why. Can someone please help me with this. It is the last thing I need to do to finish the project :eek:)

I have removed the protect and unprotect portion of the macro at this stage because at least my macro runs at the moment but I really do need to protect the sheets before I can give it to anyone to use.

Code:
Private Sub Worksheet_Calculate()
Dim myresult3 As String
Dim myresult4 As String
 
Application.ScreenUpdating = False
Application.EnableEvents = False
 
Rows("1:" & Worksheets("PUMP CONTROL").UsedRange.Rows.Count).EntireRow.Hidden = False
 
 
myresult3 = Worksheets("PUMP CONTROL").Cells(22, 1).Value 'FGC options
myresult4 = Worksheets("PUMP CONTROL").Cells(10, 1).Value 'FGC options
 
Select Case myresult4
Case "FGC"
Rows("10:11").EntireRow.Hidden = True
Rows("23:23").EntireRow.Hidden = True
End Select
 
Select Case myresult3
 
Case "", "None", "0", "APP"
Rows("21:25").EntireRow.Hidden = True
Rows("47:51").EntireRow.Hidden = True
 
End Select
Application.EnableEvents = True
Application.ScreenUpdating = True
 
End Sub
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

Forum statistics

Threads
1,215,391
Messages
6,124,673
Members
449,178
Latest member
Emilou

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top