Hello,
I hope to find you well!
I need to protect some fields of an Excel sheet, that contains the following VBA code. However, once I protect, this error is always appearing: Unable to set the hidden property of the range class.
Any ideas?
Thank you very much.
I hope to find you well!
I need to protect some fields of an Excel sheet, that contains the following VBA code. However, once I protect, this error is always appearing: Unable to set the hidden property of the range class.
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
With Sheets("Sheet1")
If Sheet1.[H20] = "PRODUCT A" Then
.CheckBoxes("Check Box 5").Visible = False
.CheckBoxes("Check Box 6").Visible = False
.CheckBoxes("Check Box 1").Visible = True
.CheckBoxes("Check Box 2").Visible = True
.Rows("21:22").EntireRow.Hidden = True
End If
If Sheet1.[H20] = "PRODUTCT B" Then
.CheckBoxes("Check Box 5").Visible = True
.CheckBoxes("Check Box 6").Visible = True
.CheckBoxes("Check Box 1").Visible = True
.CheckBoxes("Check Box 2").Visible = True
.Rows("21:22").EntireRow.Hidden = False
End If
If Sheet1.[D10] = 1 Or Sheet1.[D10] = 2 Then
.CheckBoxes("Check Box 7").Visible =False
.CheckBoxes("Check Box 8").Visible =False
.Rows("33:34").EntireRow.Hidden = False
End If
If Sheet1.[D10] = 3 Or Sheet1.[D10] = 4 Then
.CheckBoxes("Check Box 9").Visible = True
.CheckBoxes("Check Box 10").Visible = True
.Rows("33:34").EntireRow.Hidden = True
.Rows("31:32").EntireRow.Hidden = False
End If
End With
End Sub
Thank you very much.