I have a sheet that has four input columns. They are as follows
Height Width Diameter 1 Diameter 2
Only one pair can be used at a time, either Height and Width or Diameter 1 and Diameter 2
I have a script that will lock the cells of the opposite pair anytime a value is placed in one of the pairs. For instance if you put a value in Height it will change the cell property for Diameter 1 and Diameter 2 to locked.
This is working correctly, however I can still tab into the cell. I want a tab to skip that cell.
I know that there is a simple variable I am missing, can anyone help point it out for me?
Thanks in advance
Height Width Diameter 1 Diameter 2
Only one pair can be used at a time, either Height and Width or Diameter 1 and Diameter 2
I have a script that will lock the cells of the opposite pair anytime a value is placed in one of the pairs. For instance if you put a value in Height it will change the cell property for Diameter 1 and Diameter 2 to locked.
This is working correctly, however I can still tab into the cell. I want a tab to skip that cell.
I know that there is a simple variable I am missing, can anyone help point it out for me?
Thanks in advance
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
ActiveSheet.Unprotect
If Range("B6").Value >= 1 Then
ActiveSheet.Range("D6:E35").Locked = True
ElseIf Range("B6").Value < 1 Then
ActiveSheet.Range("D6:E35").Locked = False
End If
If Range("D6").Value >= 1 Then
ActiveSheet.Range("B6:C35").Locked = True
ElseIf Range("D6").Value < 1 Then
ActiveSheet.Range("B6:C35").Locked = False
End If
ActiveSheet.Protect Contents:=True
End Sub