I want to add a % discount button to one of my forms. My prices are located in G9:G18 and if a % discount is to be given Its inputed into I3. Anyone have a quick idea how to trans late that into VBA? Thanks
my price's are inputted into G9:G18 via a Vba code. So I could have any type of formula listed into that range since it would get erased. Thats why I was thinking of VBA. After the price is inputed into the range then you could input your discount into I3 and Click the button for the discount to take effect.
You could use a _Change event rather than a button:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Target.Count > 1 Then GoTo exitMe 'more than 1 cell selected
If Target.Column <> 7 Then GoTo exitMe 'not column G
If Target.Row > 18 Or Target.Row < 9 Then GoTo exitMe 'outside valid row range
If Range("I3").Value = "" Then
MsgBox "No discount entered", vbCritical, vbOKOnly
Target.Value = Target.Value * (1 - Range("I3").Value) 'apply discount
Application.EnableEvents = True
But something like this would work either way, with a few modifications. Hope that helps!