I have attempted to allow specific rows to be hidden and require the macro to protect/unprotect in the process. The macro works without a hitch until I add the protect/unprotect requirement. I'm a novist exploring macros to expand Excel. Here is what I am using:
Private Sub macrounprotect1()
Sheet1.Unprotect Password:="Money1"
End Sub
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If (Range("c11").Value = "Real Estate Secured") Then
Rows("13:27").EntireRow.Hidden = False
Rows("28:47").EntireRow.Hidden = True
End If
If (Range("c11").Value = "Unsecured") Then
Rows("28:38").EntireRow.Hidden = False
Rows("13:27").EntireRow.Hidden = True
Rows("39:47").EntireRow.Hidden = True
End If
If (Range("c11").Value = "Secured Other") Then
Rows("39:47").EntireRow.Hidden = False
Rows("28:38").EntireRow.Hidden = True
Rows("13:27").EntireRow.Hidden = True
End If
End Sub
Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
End Sub
Private Sub macroprotect2()
Sheet1.Protect Password:="Money1"
End Sub
Bookmarks