Why am I not getting calculated values in Cell A3 as I am getting in Cell M3.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("J4:J29")) Is Nothing Then
Dim H As Double
Dim G As Double
Dim M As Double
Dim revPrice As Double
H = Range("H" & Target.Row).Value
G = Range("G" & Target.Row).Value
M = Range("M" & Target.Row).Value
If H < 90 And H > 80 Then
revPrice = G - (H * M * 0.04)
ElseIf H < 81 And H > 65 Then
revPrice = G - (H * M * 0.06)
ElseIf H < 65 And H > 50 Then
revPrice = G - (H * M * 0.08)
ElseIf H < 50 And H > 35 Then
revPrice = G - (H * M * 0.1)
ElseIf H < 35 And H > 20 Then
revPrice = G - (H * M * 0.12)
ElseIf H < 20 And H > 10 Then
revPrice = G - (H * M * 0.15)
End If
Range("M3").Value = revPrice
ElseIf Not Intersect(Target, Range("D4:D29")) Is Nothing Then
Dim revPrice2 As Double
Dim F As Double
Dim G2 As Double
Dim A As Double
F = Me.Range("F" & Target.Row).Value
G2 = Me.Range("G" & Target.Row).Value
A = Me.Range("A" & Target.Row).Value
If F < 90 And F > 80 Then
revPrice2 = G + (F * A * 0.04)
ElseIf F < 80 And F > 65 Then
revPrice2 = G + (F * A * 0.06)
ElseIf F < 65 And F > 50 Then
revPrice2 = G + (F * A * 0.08)
ElseIf F < 50 And F > 35 Then
revPrice2 = G + (F * A * 0.1)
ElseIf F < 35 And F > 20 Then
revPrice2 = G + (F * A * 0.12)
ElseIf F < 20 And F > 10 Then
revPrice2 = G + (F * A * 0.15)
End If
Me.Range("A3").Value = revPrice2 ' Place the calculated revPrice2 in cell A3
End If
End Sub
Bookmarks