J
jt
I have this code:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
On Error GoTo enditall
Application.EnableEvents = False
If Cells(3, ActiveCell.Column).Value = "NAME" Then
n = Target.Row
If Cells(n, ActiveCell.Column).Value = "TOOLING" Then
Excel.Range("A" & n).Value = "T"
Target.Offset(, 1).Select
Target.Offset(, 3).FormulaR1C1 = "=IF(RC[-2]=""TOOL
LAYOUT"",""N/A"","""")"
Target.Offset(, 4).FormulaR1C1 = "=IF(RC[-3]=""TOOL
LAYOUT"",""N/A"","""")"
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop,
Operator:= _
xlBetween, Formula1:="CUTTER PATH (REFERENCE ONLY),TOOL
LAYOUT"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
End If
End If
If Cells(3, ActiveCell.Column).Value = "FEATURE NO." & Chr(10) & "/
TOOL ASSEMBLY" Then
n = Target.Row
If Cells(n, ActiveCell.Column).Value = "TOOL ASSEMBLY" Then
Excel.Range("A" & n).Value = "T"
Target.Offset(, 1).Value = "TOOLING"
Target.Offset(, 2).Select
Target.Offset(, 4).Value = "N/A"
Target.Offset(, 5).Value = "N/A"
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop,
Operator:= _
xlBetween,
Formula1:="CUTTER,DRILL,BORINGBAR,REAMER,TAP,GAUGE,BRUSH"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
End If
End If
enditall:
Application.EnableEvents = True
End Sub
works great if I hit enter but is it possible to trigger it using the
tabkey also?
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
On Error GoTo enditall
Application.EnableEvents = False
If Cells(3, ActiveCell.Column).Value = "NAME" Then
n = Target.Row
If Cells(n, ActiveCell.Column).Value = "TOOLING" Then
Excel.Range("A" & n).Value = "T"
Target.Offset(, 1).Select
Target.Offset(, 3).FormulaR1C1 = "=IF(RC[-2]=""TOOL
LAYOUT"",""N/A"","""")"
Target.Offset(, 4).FormulaR1C1 = "=IF(RC[-3]=""TOOL
LAYOUT"",""N/A"","""")"
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop,
Operator:= _
xlBetween, Formula1:="CUTTER PATH (REFERENCE ONLY),TOOL
LAYOUT"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
End If
End If
If Cells(3, ActiveCell.Column).Value = "FEATURE NO." & Chr(10) & "/
TOOL ASSEMBLY" Then
n = Target.Row
If Cells(n, ActiveCell.Column).Value = "TOOL ASSEMBLY" Then
Excel.Range("A" & n).Value = "T"
Target.Offset(, 1).Value = "TOOLING"
Target.Offset(, 2).Select
Target.Offset(, 4).Value = "N/A"
Target.Offset(, 5).Value = "N/A"
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop,
Operator:= _
xlBetween,
Formula1:="CUTTER,DRILL,BORINGBAR,REAMER,TAP,GAUGE,BRUSH"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
End If
End If
enditall:
Application.EnableEvents = True
End Sub
works great if I hit enter but is it possible to trigger it using the
tabkey also?