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
QUOTE SHEET
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