I want to be able to block a cell to prevent users from accessing it when displays all options but "mm".
When it displays "mm" I want users to be able to access the cell.
Here's the VBA code I have currently written (however I keep receiving error messages when trying to run it):
Sub ProtectCells()
ActiveSheet.Protect
Cells.Locked = True
If ("E3") = ("mm") Then
Range("G3").Locked = False
ElseIf ("E3") = Range("B3:B5") Then
Range("G3").Locked = True
End If
End Sub
Sub AddNewSheet()
ActiveSheet.Unprotect
Cells.Copy
Sheets.Add
ActiveSheet.Paste
Application.CutCopyMode = False
Run "ProtectCells"
End Sub
"E3" is the cell containing the drop down list from which the user can select options: "a","b","c" and "mm". While "G3" is the cell that I want to block access to when it is not displaying "mm". "G3" is linked to "E3" to display what is currently selected from the drop down.
Cells "B3:B5" contain the data from which the drop down list was created.
When it displays "mm" I want users to be able to access the cell.
Here's the VBA code I have currently written (however I keep receiving error messages when trying to run it):
Sub ProtectCells()
ActiveSheet.Protect
Cells.Locked = True
If ("E3") = ("mm") Then
Range("G3").Locked = False
ElseIf ("E3") = Range("B3:B5") Then
Range("G3").Locked = True
End If
End Sub
Sub AddNewSheet()
ActiveSheet.Unprotect
Cells.Copy
Sheets.Add
ActiveSheet.Paste
Application.CutCopyMode = False
Run "ProtectCells"
End Sub
"E3" is the cell containing the drop down list from which the user can select options: "a","b","c" and "mm". While "G3" is the cell that I want to block access to when it is not displaying "mm". "G3" is linked to "E3" to display what is currently selected from the drop down.
Cells "B3:B5" contain the data from which the drop down list was created.