title: Run - Time Error '13': Type Mismatch - excel user form
body: <p>I am receiving "Run time error 13" when i try to submit the user form. </p>
  
  <pre><code>dTotal1 = CDbl(sval1) + CDbl(sval2) + CDbl(sval3) + CDbl(sval4) + CDbl(sval6)
  </code></pre>
  
  <p>Here is the complete code. Please help. </p>
  
  <pre><code>Private Sub AddTextBox()
  
   Dim sval1 As Variant
   Dim sval2 As String
   Dim sval3 As String
   Dim sval4 As String
   Dim sval5 As String
   Dim sval6 As String
   Dim sval7 As String
   Dim sval8 As String
   Dim sval9 As String
   Dim sval10 As String
   Dim sval11 As String
   Dim sval12 As String
   Dim sval13 As String
   Dim sval14 As String
   Dim sval15 As String
   Dim sval16 As String
   Dim sval17 As String
   Dim sval18 As String
   Dim sval19 As String
   Dim sval20 As String
   Dim sval21 As String
   Dim sval22 As String
   Dim sval23 As String
   Dim sval24 As String
   Dim sval25 As String
  
   Dim sval100 As String
   Dim sval101 As String
   Dim sval102 As String
   Dim sval103 As String
   Dim sval104 As String
  
   Dim sval105 As String
   Dim sval106 As String
   Dim sval107 As String
   Dim sval108 As String
  
   Dim sval109 As String
   Dim sval110 As String
   Dim sval111 As String
   Dim sval112 As String
  
   Dim sval113 As String
   Dim sval114 As String
   Dim sval115 As String
  
   Dim sval116 As String
   Dim sval117 As String
  
  
  
   Dim sval31 As String
   Dim sval32 As String
   Dim sval33 As String
   Dim sval34 As String
   Dim sval35 As String
   Dim sval36 As String
   Dim sval37 As String
   Dim sval38 As String
   Dim sval39 As String
   Dim sval40 As String
   Dim sval41 As String
   Dim sval42 As String
   Dim sval43 As String
   Dim sval44 As String
   Dim sval45 As String
   Dim sval46 As String
   Dim sval47 As String
   Dim sval48 As String
  
  
  
  
   Dim dTotal1 As String
   Dim dTotal2 As String
   Dim dTotal3 As String
   Dim dTotal4 As String
   Dim dTotal5 As String
   Dim dTotal6 As String
   Dim dTotal11 As String
   Dim dTotal12 As String
   Dim dTotal13 As String
   Dim dTotal14 As String
   Dim dTotal15 As String
   Dim dTotal16 As String
   Dim dTotal17 As String
  
  With Me
  
      sval1 = .CB1.Value
      sval2 = .CB2.Value
      sval3 = .CB3.Value
      sval4 = .CB4.Value
      sval6 = .CB6.Value
      sval100 = .CB1.Value
      sval101 = .CB2.Value
      sval102 = .CB3.Value
      sval103 = .CB4.Value
      sval104 = .CB6.Value
      sval31 = .CB1.Value
      sval32 = .CB2.Value
      sval33 = .CB3.Value
      sval34 = .CB4.Value
      sval35 = .CB6.Value
  
  
  
      sval7 = .CB7.Value
      sval8 = .CB8.Value
      sval9 = .CB9.Value
      sval10 = .CB10.Value
      sval105 = .CB7.Value
      sval106 = .CB8.Value
      sval107 = .CB9.Value
      sval108 = .CB10.Value
      sval36 = .CB7.Value
      sval37 = .CB8.Value
      sval38 = .CB9.Value
      sval39 = .CB10.Value
  
  
  
      sval11 = .CB11.Value
      sval12 = .CB12.Value
      sval13 = .CB13.Value
      sval14 = .CB14.Value
      sval109 = .CB11.Value
      sval110 = .CB12.Value
      sval111 = .CB13.Value
      sval112 = .CB14.Value
      sval40 = .CB11.Value
      sval41 = .CB12.Value
      sval42 = .CB13.Value
      sval43 = .CB14.Value
  
  
  
      sval15 = .CB15.Value
      sval16 = .CB16.Value
      sval17 = .CB17.Value
      sval113 = .CB15.Value
      sval114 = .CB16.Value
      sval115 = .CB17.Value
      sval44 = .CB15.Value
      sval45 = .CB16.Value
      sval46 = .CB17.Value
  
  
      sval18 = .CB18.Value
      sval19 = .CB19.Value
      sval116 = .CB18.Value
      sval117 = .CB19.Value
      sval47 = .CB18.Value
      sval48 = .CB19.Value
  
  
      If sval1 = "" Or sval1 = "NA" Then sval1 = 0
      If sval2 = "" Or sval2 = "NA" Then sval2 = 0
      If sval3 = "" Or sval3 = "NA" Then sval3 = 0
      If sval4 = "" Or sval4 = "NA" Then sval4 = 0
      If sval6 = "" Or sval6 = "NA" Then sval6 = 0
    If sval100 = "NA" Then sval100 = 0 Else sval100 = 5
    If sval101 = "NA" Then sval101 = 0 Else sval101 = 3
    If sval102 = "NA" Then sval102 = 0 Else sval102 = 3
    If sval103 = "NA" Then sval103 = 0 Else sval103 = 4
    If sval104 = "NA" Then sval104 = 0 Else sval104 = 5
      If sval7 = "" Or sval7 = "NA" Then sval7 = 0
      If sval8 = "" Or sval8 = "NA" Then sval8 = 0
      If sval9 = "" Or sval9 = "NA" Then sval9 = 0
      If sval10 = "" Or sval10 = "NA" Then sval10 = 0
    If sval105 = "NA" Then sval105 = 0 Else sval105 = 7
    If sval106 = "NA" Then sval106 = 0 Else sval106 = 3
    If sval107 = "NA" Then sval107 = 0 Else sval107 = 2
    If sval108 = "NA" Then sval108 = 0 Else sval108 = 2
      If sval11 = "" Or sval11 = "NA" Then sval11 = 0
      If sval12 = "" Or sval12 = "NA" Then sval12 = 0
      If sval13 = "" Or sval13 = "NA" Then sval13 = 0
      If sval14 = "" Or sval14 = "NA" Then sval14 = 0
    If sval109 = "NA" Then sval109 = 0 Else sval109 = 5
    If sval110 = "NA" Then sval110 = 0 Else sval110 = 3
    If sval111 = "NA" Then sval111 = 0 Else sval111 = 8
    If sval112 = "NA" Then sval112 = 0 Else sval112 = 10
      If sval15 = "" Or sval15 = "NA" Then sval15 = 0
      If sval16 = "" Or sval16 = "NA" Then sval16 = 0
      If sval17 = "" Or sval17 = "NA" Then sval17 = 0
    If sval113 = "NA" Then sval113 = 0 Else sval113 = 8
    If sval114 = "NA" Then sval114 = 0 Else sval114 = 10
    If sval115 = "NA" Then sval115 = 0 Else sval115 = 10
      If sval18 = "" Or sval18 = "NA" Then sval18 = 0
      If sval19 = "" Or sval19 = "NA" Then sval19 = 0
    If sval116 = "NA" Then sval116 = 0 Else sval116 = 5
    If sval117 = "NA" Then sval117 = 0 Else sval117 = 7
  
  
  
  
      dTotal11 = CDbl(sval100) + CDbl(sval101) + CDbl(sval102) + CDbl(sval103) + CDbl(sval104)
      dTotal12 = CDbl(sval105) + CDbl(sval106) + CDbl(sval107) + CDbl(sval108)
      dTotal13 = CDbl(sval109) + CDbl(sval110) + CDbl(sval111) + CDbl(sval112)
      dTotal14 = CDbl(sval113) + CDbl(sval114) + CDbl(sval115)
      dTotal15 = CDbl(sval116) + CDbl(sval117)
  
  
  
  
  
      dTotal1 = CDbl(sval1) + CDbl(sval2) + CDbl(sval3) + CDbl(sval4) + CDbl(sval6)
      dTotal2 = CDbl(sval7) + CDbl(sval8) + CDbl(sval9) + CDbl(sval10)
      dTotal3 = CDbl(sval11) + CDbl(sval12) + CDbl(sval13) + CDbl(sval14)
      dTotal4 = CDbl(sval15) + CDbl(sval16) + CDbl(sval17)
      dTotal5 = CDbl(sval18) + CDbl(sval19)
  
  
  
      .TextBox1 = Format(dTotal1, "0")
      .TextBox8 = Format(dTotal11, "0")
      .TextBox2 = Format(dTotal2, "0")
      .TextBox9 = Format(dTotal12, "0")
      .TextBox3 = Format(dTotal3, "0")
      .TextBox10 = Format(dTotal13, "0")
      .TextBox4 = Format(dTotal4, "0")
      .TextBox11 = Format(dTotal14, "0")
      .TextBox5 = Format(dTotal5, "0")
      .TextBox12 = Format(dTotal15, "0")
  
  
    End With
  
  
  
  With Me
      If dTotal1 = "" Then dTotal1 = 0
      If dTotal2 = "" Then dTotal2 = 0
      If dTotal3 = "" Then dTotal3 = 0
      If dTotal4 = "" Then dTotal4 = 0
      If dTotal5 = "" Then dTotal5 = 0
  
  
      If dTotal11 = "" Then dTotal11 = 0
      If dTotal12 = "" Then dTotal12 = 0
      If dTotal13 = "" Then dTotal13 = 0
      If dTotal14 = "" Then dTotal14 = 0
      If dTotal15 = "" Then dTotal15 = 0
  
  
  
  
      dTotal6 = CDbl(dTotal1) + CDbl(dTotal2) + CDbl(dTotal3) + CDbl(dTotal4) + CDbl(dTotal5)
      dTotal16 = CDbl(dTotal11) + CDbl(dTotal12) + CDbl(dTotal13) + CDbl(dTotal14) + CDbl(dTotal15)
  
  
         .TextBox6 = Format((dTotal6 / dTotal16), "Percent")
  
    End With
  
  End Sub
  </code></pre>