title: Unable to add cell values based on the Checkbox selection from Userform
body: <p>I'm writing a Userform</p>
  
  <p>What I am trying to achieve: while running my Userform with multiple selection checkboxes.</p>
  
  <ol>
  <li>Collect all checked checkboxes captions along with its parent frame name</li>
  <li>Filtering database on its first column with those collected strings</li>
  <li>Loop through filtered cells and make the wanted sums</li>
  <li>The selection can contain each row with different columns (Based on checkbox selection)</li>
  </ol>
  
  <p>Refer Example below for better understanding</p>
  
  <p><a href="https://i.stack.imgur.com/cyNIw.png" rel="nofollow noreferrer">Excel sheet snapshot which contains data</a></p>
  
  <p><a href="https://i.stack.imgur.com/DbvyV.png" rel="nofollow noreferrer">Userform</a></p>
  
  <p>Coded for <strong>Estimate button</strong></p>
  
  <pre><code>Private Sub preflight_calculate_Click()
  Dim preflight_resource As Double, preflight_time As Double
  
  preflight_resource = Val(Me.preflight_resource)
  preflight_time = Val(Me.preflight_time)
  Dim cell As Range
  With ThisWorkbook.Sheets("Preflight")
      With .Range("A2", .Cells(.Rows.Count, 1).End(xlUp))
          .AutoFilter 1, Criteria1:=GetCheckedCaptions, Operator:=xlFilterValues
          For Each cell In .SpecialCells(xlCellTypeVisible)
              preflight_resource = Val(preflight_resource) + cell.Offset(, 6).Value
              preflight_time = Val(preflight_time) + cell.Offset(, 8).Value
          Next
      End With
      .AutoFilterMode = False
  End With
  
  With Me
      .preflight_resource.Text = preflight_resource
      .preflight_time.Text = preflight_time
  End With
  End Sub
  
  Function GetCheckedCaptions() As Variant
  Dim ctl As Control
  With Me
      For Each ctl In .Controls
          If TypeName(ctl) = "CheckBox" Then
              If ctl.Value Then
                  GetCheckedCaptions = GetCheckedCaptions &amp; " " &amp; ctl.Parent.Caption &amp; "-" &amp; ctl.Caption
              End If
          End If
      Next
  End With
  GetCheckedCaptions = Split(Trim(GetCheckedCaptions))
  End Function
  </code></pre>
  
  <p><strong>Expected result: 
  For Example:</strong></p>
  
  <p>If I select the checkbox as follows US -> Mobile -> P0 and US -> Desktop -> P1</p>
  
  <p><strong>Output should be:</strong></p>
  
  <p>Textboxes below: </p>
  
  <p>Resource Utilized: (F2 + G3) -> (0.73 + 0.62) -> <strong>1.35</strong> (Inside text box)</p>
  
  <p>Time in Hours: (H2 + I3) -> (5.87 + 4.95) -> <strong>10.82</strong> (Inside text box)</p>
  
  <p>How to achieve this? </p>
  
  <p>My Excel file link: ("Preflight" is the sheet name where the data is present) Userform will be visible from "Estimation Form" sheet</p>
  
  <p><a href="https://drive.google.com/file/d/1K2LdVuJXNZoavrkcQgslY20c4R9nlRfo/view?usp=sharing" rel="nofollow noreferrer">https://drive.google.com/file/d/1K2LdVuJXNZoavrkcQgslY20c4R9nlRfo/view?usp=sharing</a></p>