Need assistance merging the 2 routines below to avoid duplication of Private Sub Worksheet_Change(ByVal Target As Range)
Excel 2003
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row = D010.Range("IncidentDes").Row And Target.Column = D010.Range("IncidentDes").Column Then
If Len(Target.Value) > gciMaxTxtLen Then
Load frmTextEntry
frmTextEntry.Show
D010.Range("SC1").Select
End If
End If
End Sub
_________________________________________________________________
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$B$3" Then
Application.EnableEvents = False
If Target.Value <> "Drilling" Then
With Range("C3")
.Value = "HLV"
With .Validation
.Delete
.Add Type:=xlValidateTextLength, _
AlertStyle:=xlValidAlertStop, _
Operator:=xlEqual, Formula1:="0"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = "Leave cell blank"
.ShowInput = False
.ShowError = True
End With
End With
Else
With Range("C3")
.Value = ""
With .Validation
.Delete
.Add Type:=xlValidateList, _
AlertStyle:=xlValidAlertStop, _
Operator:=xlEqual, Formula1:="=Class"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = "Select from the list"
.ShowInput = False
.ShowError = True
End With
End With
End If
End If
Application.EnableEvents = True
End Sub
Excel 2003
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row = D010.Range("IncidentDes").Row And Target.Column = D010.Range("IncidentDes").Column Then
If Len(Target.Value) > gciMaxTxtLen Then
Load frmTextEntry
frmTextEntry.Show
D010.Range("SC1").Select
End If
End If
End Sub
_________________________________________________________________
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$B$3" Then
Application.EnableEvents = False
If Target.Value <> "Drilling" Then
With Range("C3")
.Value = "HLV"
With .Validation
.Delete
.Add Type:=xlValidateTextLength, _
AlertStyle:=xlValidAlertStop, _
Operator:=xlEqual, Formula1:="0"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = "Leave cell blank"
.ShowInput = False
.ShowError = True
End With
End With
Else
With Range("C3")
.Value = ""
With .Validation
.Delete
.Add Type:=xlValidateList, _
AlertStyle:=xlValidAlertStop, _
Operator:=xlEqual, Formula1:="=Class"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = "Select from the list"
.ShowInput = False
.ShowError = True
End With
End With
End If
End If
Application.EnableEvents = True
End Sub