I am trying to modify the following code:
Public Sub Worksheet_Change(ByVal Target As Range)
Dim pctVal As Double
If Intersect(Target, Range("I14:I44")) Is Nothing _
Or Target.Cells.Count > 1 Then Exit Sub
If IsEmpty(Target) = True Then Exit Sub
With Target
If IsNumeric(.Value) Then
Select Case Cells(.Row, .Column - 4).Value
Case "LTL": pctVal = 1.08
Case "TL": pctVal = 1.1
Case "Tank Truck": pctVal = 1.09
Case "IM": pctVal = 1.12
Case Else: pctVal = 1
End Select
Application.EnableEvents = False
.Value = .Value * pctVal
Application.EnableEvents = True
End If
End With
If Intersect(Target, Range("J14:J44")) Is Nothing _
Or Target.Cells.Count > 1 Then Exit Sub
If IsEmpty(Target) = True Then Exit Sub
With Target
If IsNumeric(.Value) Then
Select Case Cells(.Row, .Column - 5).Value
Case "LTL": pctVal = 1.08
Case "TL": pctVal = 1.1
Case "Tank Truck": pctVal = 1.09
Case "IM": pctVal = 1.12
Case Else: pctVal = 1
End Select
Application.EnableEvents = False
.Value = .Value * pctVal
Application.EnableEvents = True
End If
End With
The problem is that before the second If Intersect is reached, the sub is exited. I want to make this code update columns I, J, K & L.
Public Sub Worksheet_Change(ByVal Target As Range)
Dim pctVal As Double
If Intersect(Target, Range("I14:I44")) Is Nothing _
Or Target.Cells.Count > 1 Then Exit Sub
If IsEmpty(Target) = True Then Exit Sub
With Target
If IsNumeric(.Value) Then
Select Case Cells(.Row, .Column - 4).Value
Case "LTL": pctVal = 1.08
Case "TL": pctVal = 1.1
Case "Tank Truck": pctVal = 1.09
Case "IM": pctVal = 1.12
Case Else: pctVal = 1
End Select
Application.EnableEvents = False
.Value = .Value * pctVal
Application.EnableEvents = True
End If
End With
If Intersect(Target, Range("J14:J44")) Is Nothing _
Or Target.Cells.Count > 1 Then Exit Sub
If IsEmpty(Target) = True Then Exit Sub
With Target
If IsNumeric(.Value) Then
Select Case Cells(.Row, .Column - 5).Value
Case "LTL": pctVal = 1.08
Case "TL": pctVal = 1.1
Case "Tank Truck": pctVal = 1.09
Case "IM": pctVal = 1.12
Case Else: pctVal = 1
End Select
Application.EnableEvents = False
.Value = .Value * pctVal
Application.EnableEvents = True
End If
End With
The problem is that before the second If Intersect is reached, the sub is exited. I want to make this code update columns I, J, K & L.