title: Results not factoring into excel vba spreadsheet
body: <p>(EDITED, Issue partly resolved, see comments) I'm new to VBA so this might be tedious but: I'm having some issues with code I've written to try to add discounts to an invoice. I have it so that if a 1 is written in a certain row under one discount column in 'Org List', that discount number is reflected in the cost column of 'QuickCalcs', for the items associated with the organization having the discount. I've tested it to make sure the if statements are working correctly, and they are. The calculations are also correct, but for some reason these values aren't replacing the original costs calculated by multiplying quantity and rate. It seems the amount.value = amount.value - dis1 line and the others like it aren't working, or maybe I'm misunderstanding it. When I was testing, I had amount.value appear in another empty cell and the correct value showed, but it doesn't seem to be working when entering it into a cell with a preexisting amount for some reason, though this may not be the issue. How would you recommend I fix this so that the correct discounted amounts are reflected in the cost column (QuickCalcs, col L)? My code is below. Thank you!!</p>
  <pre><code>Sub Discounts()
      Dim orgnameB    As Range
      Dim orgListB    As Range
      Set orgListB = Worksheets(&quot;Org List&quot;).Range(&quot;B3:B23&quot;)
      Dim siteTC      As Range
      Dim TCsites     As Range
      Set TCsites = Worksheets(&quot;TC Site Report&quot;).Range(&quot;B2:B23&quot;)
      Dim itemDescr   As Range
      Dim quickcalcsI As Range
      Set quickcalcsI = Worksheets(&quot;QuickCalcs&quot;).Range(&quot;I2:I23&quot;)
      
      ' Amount Calculation
      Dim amount      As Range
      Dim rateval     As Range
      Dim qtyval      As Range
      Dim total       As Double
      Dim dis1        As Integer
      Dim dis2        As Integer
      Dim dis3        As Integer
      Dim dis4        As Integer
      Dim dis5        As Integer
      Dim dis6        As Integer
      
      For Each orgnameB In orgListB
          If IsEmpty(orgnameB) = TRUE Then
              Exit For
          End If
          For Each siteTC In TCsites
              For Each itemDescr In quickcalcsI
                  Set amount =     Worksheets(&quot;QuickCalcs&quot;).Cells(itemDescr.row, &quot;L&quot;)
                  Set rateval = Worksheets(&quot;QuickCalcs&quot;).Cells(itemDescr.row, &quot;K&quot;)
                  Set qtyval = Worksheets(&quot;QuickCalcs&quot;).Cells(itemDescr.row, &quot;J&quot;)
                  amount.Value = rateval.Value * qtyval.Value
                  total = amount.Value
                  
                  If Worksheets(&quot;Org List&quot;).Cells(orgnameB.row, &quot;I&quot;).Value = 1 Or Worksheets(&quot;Org List&quot;).Cells(orgnameB.row, &quot;K&quot;).Value = 1 Or Worksheets(&quot;Org List&quot;).Cells(orgnameB.row, &quot;J&quot;).Value = 1 Then
                      ' If discount : if orgnameB.row, colI,J, or K = 1, apply discount
                      
                      If itemDescr.Value = siteTC.Value Then
                          
                          'If current item in quickcalcs = item in TC Site Report
                          If Worksheets(&quot;TC Site Report&quot;).Cells(siteTC.row, &quot;D&quot;) = orgnameB.Value And Worksheets(&quot;QuickCalcs&quot;).Cells(itemDescr.row, &quot;H&quot;) &lt;&gt; &quot;Annual Fee&quot; Then
                              'If current item in quickcalcs is associated with that org
                              If Worksheets(&quot;Org List&quot;).Cells(orgnameB.row, &quot;I&quot;) = 1 Then
                                  percentoff1 = Worksheets(&quot;Org List&quot;).Cells(2, &quot;I&quot;).Value / 100
                                  dis1 = total * (percentoff1)
                                  amount.Value = amount.Value - dis1
                              End If
                              If Worksheets(&quot;Org List&quot;).Cells(orgnameB.row, &quot;J&quot;) = 1 Then
                                  percentoff2 = Worksheets(&quot;Org List&quot;).Cells(2, &quot;I&quot;).Value / 100
                                  dis2 = total * (percentoff2)
                                  amount.Value = amount.Value - dis2
                              End If
                              If Worksheets(&quot;Org List&quot;).Cells(orgnameB.row, &quot;K&quot;) = 1 Then
                                  percentoff3 = Worksheets(&quot;Org List&quot;).Cells(2, &quot;I&quot;).Value / 100
                                  dis3 = total * (percentoff3)
                                  amount.Value = amount.Value - dis3
                              End If
                          End If
                      End If
                  End If
              Next
          Next
      Next
      
  End Sub
  </code></pre>
  <p><a href="https://i.stack.imgur.com/I5Hjn.png" rel="nofollow noreferrer">Ranges Worked with, QuickCalcs Tab</a></p>
  <p><a href="https://i.stack.imgur.com/bFGxD.png" rel="nofollow noreferrer">Ranges Worked with, TC Site Report Tab</a></p>
  <p><a href="https://i.stack.imgur.com/elEyP.png" rel="nofollow noreferrer">Ranges Worked with, Org List</a></p>