Protection keeps turning itself on -but only on my managers PC

RobbieNZ

New Member
Joined
Aug 17, 2010
Messages
21
I have a workbook that is used to create client quotes.
Two of the sheets have macros within them
1. Macro in QUOTE sheet hides/unhides rows based on result in column A. It is triggered by a control button.
It unprotects the sheet when the control button is clicked and then protects it again when it has run (See macro code below)

2. PUMP CONTROL input sheet has a macro that hides/unhides rows based on the selection in a drop down box to allow options to be hidden if not required for that drop down box selection.

3. I had applied protection manually to a third visible sheet CUSTOMER ENQUIRY. This sheet and no others in the workbook contain macros
There are no workbook level macros either.

4. A hidden sheet called COSTINGS is where all the information comes together, looks up part numbers and pricing in three other hidden sheets.\
No macros in it yet I watched the manager have to keep unprotecting the sheet to enter data?


My manager said when he tries to manually hide rows in QUOTE that the protection turns on. He then manually turns it off, only to have the same thing happen when he next tries to hide/unhide rows.

The data in PUMP CONTROL and CUSTOMER ENQUIRY sheets feeds in to the QUOTE and COSTING Sheets but I would have thought that if the macro in QUOTE sheet is run by a control button it wouldn't activate until it was pressed, which is why I used one.

Can a protection on the CUSTOMER ENQUIRY or the PUMP CONTROL sheets which are linked to the QUOTE and COSTING sheets affect the protection on QUOTE and COSTING?

I did try to generate the same issue on my PC but with no luck. I can hide and unhide rows on the QUOTE sheet without issue.

I have checked all other sheets, there are no other macros in them

I thought it might be a setting in 2003 I am unaware of? As I said my PC does not do this.

Just in case
Please find my code for each sheet attached (This is the first job I have used macros in so just a little bewildered by this issue. IF it is a macro issue please let me know and I can always repost on the excel issues forum.

Thanks in advance
Robbie

PUMP CONTROL SHEET
PHP:
Private Sub Worksheet_Calculate()
Dim myresult3 As String
Dim myresult4 As String
 
Application.ScreenUpdating = False
Application.EnableEvents = False
ActiveSheet.Unprotect Password:="Bruce"
 
'first it unhide any rows that are currently hidden.
Rows("1:" & Worksheets("PUMP CONTROL").UsedRange.Rows.Count).EntireRow.Hidden = False
'Cells(91,1) mean the cell in the 91 st row and the 1 st column, ie A91
'MyResult is the variable that takes it value.
 
myresult3 = Worksheets("PUMP CONTROL").Cells(22, 1).Value 'FGC options
myresult4 = Worksheets("PUMP CONTROL").Cells(10, 1).Value 'FGC options
 
Select Case myresult4
'Including the value 0 in case of a direct a = b type of thing; if you're confident that
'0 will never mean Empty String, remove it from the case
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
ActiveSheet.Protect Password:="Bruce"
Application.EnableEvents = True
Application.ScreenUpdating = True
'Application.EnableEvents = True 
End Sub

QUOTE SHEET
PHP:
Private Sub CommandButton1_Click()
 Dim cell As Range
    Application.ScreenUpdating = False
    ActiveSheet.Unprotect Password:="Bruce"
 
    With Worksheets("Q U O T E")
 
        .Rows("58:178").Hidden = False
 
        On Error Resume Next
        For Each cell In .Range("A58:A178")
 
                If Not IsEmpty(cell) And cell.Value = 0 Then cell.EntireRow.Hidden = True
 
        Next cell
        On Error GoTo 0
 
    End With
    ActiveSheet.Protect Password:="Bruce"
    Application.ScreenUpdating = True
 
End Sub
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
You are protecting the active sheet on a calculation

Code:
[COLOR=#000000][COLOR=#0000bb][/COLOR][FONT=Courier New][COLOR=#007700]Private [/COLOR][COLOR=#0000bb]Sub Worksheet_Calculate[/COLOR][/FONT][COLOR=#007700][FONT=Courier New]()[/FONT]
[/COLOR][/COLOR]
ActiveSheet.Protect Password:="Bruce"
.....

You could put something like
Code:
if activesheet.name <> "QUOTE" then
         ActiveSheet.Protect Password:="Bruce"
end if
 
Upvote 0

Forum statistics

Threads
1,216,118
Messages
6,128,939
Members
449,480
Latest member
yesitisasport

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