title: How to subtract when uncheck a checkbox
body: <p>So I have this code where if I check a checkbox it adds the value to total, but if I uncheck it, it doesn't subtract the value</p>
  <pre><code>Private Sub CheckBox11_Click()
  
  Dim ws As Worksheet
  Dim wf As WorksheetFunction
  Dim sValue As String
  Dim sAdd As Boolean
  
  Set wf = Application.WorksheetFunction
  Set ws = Sheet2
  
  If CheckBox11.Value = True Then
      LastRow = ws.Cells(ws.Rows.Count, &quot;A&quot;).End(xlUp).Row
      sValue = wf.VLookup(ComboBox1.Value, ws.Range(&quot;A4:R&quot; &amp; LastRow), 13, False)
      
      TextBox11.Value = sValue &amp; &quot; €&quot;
      sAdd = True
  Else
      TextBox11.Value = &quot;&quot;
      sValue = &quot;0&quot;
      sAdd = False
  End If
  
  Call TotalValue(sValue, sAdd)
  
  End Sub
  </code></pre>
  <p>Total value function :</p>
  <pre><code>  Function TotalValue(BoxValue As String, sAdd As Boolean, Optional Desc As String) As String
  
  Dim auxDesc As Double
  Dim auxValue As Double
  
  If UserForm1.TextBox17.Value = &quot;0&quot; Then
  
      If sAdd = True Then
          UserForm1.TextBox17.Value = BoxValue
      End If
      
  Else
  
      If sAdd = True Then
          UserForm1.TextBox17.Value = CStr(CDec(UserForm1.TextBox17.Value) + CDec(BoxValue))
      Else
          UserForm1.TextBox17.Value = CStr(CDec(UserForm1.TextBox17.Value) - CDec(BoxValue))
      End If
      
  End If
  
  If Desc &lt;&gt; &quot;&quot; Then
      auxDesc = Left(Desc, Len(Desc) - 1) / 100
      auxValue = CDec(UserForm1.TextBox17.Value) * auxDesc
  
      UserForm1.TextBox17.Value = CStr(CDec(UserForm1.TextBox17.Value) - auxValue)
      
  End If
      
  End Function
  </code></pre>
  <p>What I want is if I uncheck the box to subtract the total value, if I check it adds the value on total , if I uncheck it keeps &quot;added&quot; doesn't subtract :(</p>
  <p>Any help?</p>