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 )
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.
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 )
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