Basically I will have 14 sheets, first 13 are marked '1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 & 13, and the last one is named 'Input'.
Now in sheet 1 - cell C2 I will have the value of =Input!A2 (which would be the sales person name).
If there is no name in C2, then I would like it to hide column C and D.
The only thing I'm confused about is the Range part of the formula. I'm not sure if I'm doing it properly.
This is what I have.
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$C$2" And Target.Value > "" Then
ActiveSheet.Unprotect ("password")
Range("C:C").EntireColumn.Hidden = False
Range("D:D").EntireColumn.Hidden = False
ActiveSheet.Protect ("password")
Else
If Target.Address = "$C$2" And Target.Value = "0" Then
ActiveSheet.Unprotect ("password")
Range("C:C").EntireColumn.Hidden = True
Range("D:D").EntireColumn.Hidden = True
ActiveSheet.Protect ("password")
End If
End If
End Sub
Now in sheet 1 - cell C2 I will have the value of =Input!A2 (which would be the sales person name).
If there is no name in C2, then I would like it to hide column C and D.
The only thing I'm confused about is the Range part of the formula. I'm not sure if I'm doing it properly.
This is what I have.
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$C$2" And Target.Value > "" Then
ActiveSheet.Unprotect ("password")
Range("C:C").EntireColumn.Hidden = False
Range("D:D").EntireColumn.Hidden = False
ActiveSheet.Protect ("password")
Else
If Target.Address = "$C$2" And Target.Value = "0" Then
ActiveSheet.Unprotect ("password")
Range("C:C").EntireColumn.Hidden = True
Range("D:D").EntireColumn.Hidden = True
ActiveSheet.Protect ("password")
End If
End If
End Sub