PDA

View Full Version : [SOLVED] Increase Target.Value By Percentage



Opv
10-06-2014, 03:24 PM
I thought this was going to be simple but I continue to receive an "Expected Expression" error. What I'm attempting to do is test for whether the Target contains a formula and if so to automatically adjust the Target.Value by 109.5%.


Private Sub Worksheet_Change(ByVal Target As Range)
If Target.HasFormula Then
Application.EnableEvents = False
Target.Value = Target.Value = (Target.Value * 109.5%)
Application.EnableEvents = True
End If

End Sub


Why would this not work? Is there a work-around to make accomplish the same objective?

Bob Phillips
10-06-2014, 03:35 PM
You do realise this will erase the formula?


Private Sub Worksheet_Change(ByVal Target As Range)
If Target.HasFormula Then
Application.EnableEvents = False
Target.Value = Target.Value * 2.095
Application.EnableEvents = True
End If
End Sub

Opv
10-06-2014, 03:43 PM
Indeed I do. That is my objective. The formula is only needed for one-time data entry purposes in this application...once the results of the formula has been increased by the desired percentage, it's the value that I want to retain. Thanks for the help!