Hi folks,
I would appreciate if you help in following.
I have a password protected sheet and the vba that uprotects/protects and runs the code. However while unprotecting it shows the formula bar, which I would like to keep hidden. Any suggestions, please?
Private Sub Worksheet_Change(ByVal Target As Range)
ThisWorkbook.Worksheets("Sheet1").Unprotect Password:="password"
'Unprotect
If Range("B20").Value = "Yes" Then
Rows("26:40").EntireRow.Hidden = False
End If
If Range("B20").Value = "No" Then
Rows("26:40").EntireRow.Hidden = True
ElseIf Range("B20").Value = 0 Then
Rows("26:40").EntireRow.Hidden = True
ThisWorkbook.Worksheets("Sheet1").Protect Password:="password"
'Protect
End If
End Sub
I would appreciate if you help in following.
I have a password protected sheet and the vba that uprotects/protects and runs the code. However while unprotecting it shows the formula bar, which I would like to keep hidden. Any suggestions, please?
Private Sub Worksheet_Change(ByVal Target As Range)
ThisWorkbook.Worksheets("Sheet1").Unprotect Password:="password"
'Unprotect
If Range("B20").Value = "Yes" Then
Rows("26:40").EntireRow.Hidden = False
End If
If Range("B20").Value = "No" Then
Rows("26:40").EntireRow.Hidden = True
ElseIf Range("B20").Value = 0 Then
Rows("26:40").EntireRow.Hidden = True
ThisWorkbook.Worksheets("Sheet1").Protect Password:="password"
'Protect
End If
End Sub