I've modified a VB code to show and hide rows based on the value of a cell. The code works well, but I need to password protect the sheet, and of course once the sheet is protected the VB won't run.
I've tried a few variations but I'm not a programmer so I'm just not getting it - could someone smarter please help me out?
Code as below:
Private Sub Worksheet_Change(ByVal Target As Range)
Rows("1:" & Rows.Count).EntireRow.Hidden = False
If Range("M11") = "0" Then
Rows("13:92").EntireRow.Hidden = True
End If
If Range("M11") = "Mini" Then
Rows("13:18").EntireRow.Hidden = True
Rows("38:57").EntireRow.Hidden = True
End If
If Range("M11") = "Small" Then
Rows("13:18").EntireRow.Hidden = True
Rows("43:57").EntireRow.Hidden = True
End If
If Range("M11") = "Standard" Then
Rows("13:18").EntireRow.Hidden = True
End If
End Sub
I tried variations of unlock code, but I don't know enough about programming to know how it all fits together, so I just get errors.
UserInterfaceOnly = True. The macros will be able to make changes to the worksheet but it will be locked against user editing.