I am trying to automatically change values by a percentage when they are entered based on criteria contained in a previous row.
I have tried to do this using the following code:
Public Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("I14:I44")) Is Nothing Then
With Target
If IsNumeric(.Value) Then
.Value = .Value * 1.08
End If
End With
End If
ws_exit:
Application.EnableEvents = True
End Sub
Problem is I want to calculate a different percentage based on the values of "E14:E44" which are bound by the following list: "LTL", "Truckload", "Tank Truck" & "IM". I think some sort of Vlookup would be ideal but not sure if that can be incorporated into Worksheet_change.
Any help is greatly appreciated!
Public Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("I14:I44")) Is Nothing Then
With Target
If IsNumeric(.Value) Then
.Value = .Value * 1.08
End If
End With
End If
ws_exit:
Application.EnableEvents = True
End Sub
Problem is I want to calculate a different percentage based on the values of "E14:E44" which are bound by the following list: "LTL", "Truckload", "Tank Truck" & "IM". I think some sort of Vlookup would be ideal but not sure if that can be incorporated into Worksheet_change.
Any help is greatly appreciated!