title: VBA UserForm - Run Time Error 1004 'Application Defined or Object Defined Error'
body: <p>I get</p>
  
  <blockquote>
    <p>Run Time Error 1004 'Application Defined or Object Defined Error'</p>
  </blockquote>
  
  <p>on the first Cells Value line <code>( .Cells(last, 1).Value = Val(TextBox1) )</code> when I want to run my Userform. </p>
  
  <p>The Userform is triggered with a button located on another sheet and the data typed in the userform shall be delivered to the first empty row on my worksheet "MBE_Statistik". Because my data on this sheet is formatted as a table I first want to activate autofill and expand for tables (as the archive will be opened on different computers with probably different settings).</p>
  
  <pre><code>Private Sub CommandButton1_Click()
  
  Dim last As Long
  
  With Application.AutoCorrect
  .AutoExpandListRange = True
  .AutoFillFormulasInLists = True
  
  End With
  
  last = ThisWorkbook.Worksheets("MBE_Statistik").Cells(Rows.Count, 1).End(xlUp).Row + 1
  
  With ThisWorkbook.Worksheets("MBE_Statistik")
  
  'KW
  .Cells(last, 1).Value = Val(TextBox1)
  
  'Center Code
  .Cells(last, 3).Value = Val(TextBox2)
  
  'Ort
  .Cells(last, 4).Value = Val(TextBox3)
  
  'Projekt
  If OptionButton1.Value = True Then .Cells(last, 5).Value = "Neustarter"
  If OptionButton2.Value = True Then .Cells(last, 5).Value = "ISB"
  If OptionButton3.Value = True Then .Cells(last, 5).Value = "Leadgenerierung"
  If OptionButton4.Value = True Then .Cells(last, 5).Value = "Center Flights"
  
  'Flight-Nr
  .Cells(last, 6).Value = Val(TextBox5)
  
  'Ansprechpartner
  .Cells(last, 7).Value = Val(TextBox4)
  
  'Agent
  .Cells(last, 10).Value = Val(TextBox6)
  
  'Ist-Stunden
  .Cells(last, 8).Value = Val(TextBox13)
  
  'Ist-Stunden
  .Cells(last, 9).Value = Val(TextBox7)
  
  'Wählversuche
  .Cells(last, 11).Value = Val(TextBox8)
  
  'Erreicht AP/Entscheider
  .Cells(last, 12).Value = Val(TextBox9)
  
  'Kein Interesse
  .Cells(last, 13).Value = Val(TextBox16)
  
  .
  .
  .
  
  End With
  
  End Sub
  </code></pre>
  
  <p>There are some more textboxes which I left out at the moment as the error is highlighted on the first. </p>
  
  <p>Can somebody help me find the problem?</p>