title: How to copy the value from Userform textbox to multple cells in spreadsheet
body: <p>I have a simple Userform with two textboxes.  User is to enter Part Description in one labelled &quot;Panel ID&quot; and the number of rows that description is to be entered in the same column of the spreadsheet (Quantity). By now, I am OK with adding value in empty row, but got stuck at copying the value to other cells.  I have code for copying the value in set range, but cannot find anything that works for what I am looking for.  Thanks</p>
  <p><a href="https://i.stack.imgur.com/mnRsL.png" rel="nofollow noreferrer">Apples</a> <a href="https://i.stack.imgur.com/SG12W.png" rel="nofollow noreferrer">Oranges</a> <a href="https://i.stack.imgur.com/qFg4h.png" rel="nofollow noreferrer">List</a></p>
  <pre><code>  Private Sub SubmitBtn_Click()
    Dim iRow As Long, C As Long
    Dim sh As Worksheet
  
  
    Set sh = ThisWorkbook.Sheets(&quot;Data&quot;)
  
    iRow = sh.Cells(Rows.Count, 1).End(xlUp).Row + 1
    C = QTYBox.Value
  
    With sh
  
    .Cells(iRow, 1) = TxtPanel.Value
    
    End With
  
    End Sub
  
    Private Sub UserForm_Initialize()
  
    'Empty Panel ID cell
    TxtPanel.Value = &quot;&quot;
  
    'Empty Quantity cell
    QTYBox.Value = &quot;&quot;
  
    'Set focus to panel ID cell
    TxtPanel.SetFocus
  
    End Sub
   
  </code></pre>
  <p>This is code for second problem:
  <a href="https://i.stack.imgur.com/hycjp.png" rel="nofollow noreferrer">crate form</a>
  <a href="https://i.stack.imgur.com/uWYgQ.png" rel="nofollow noreferrer">crate spreadsheet</a></p>
  <pre class="lang-vb prettyprint-override"><code>Private Sub SubmitBtn_Click()
  
      Dim i As Long
      Dim sh As Worksheet
      Dim lRow As Long
  
      Set sh = ThisWorkbook.Sheets(&quot;Data&quot;)
      lRow = sh.Cells(Rows.Count, 1).End(xlUp).Row
  
      With sh
          For i = 2 To lRow
  
              'Criteria search        
              If .Cells(i, 1).Value = PanelTxt.Value Then
                  If .Cells(i, 2).Value = IDTxt.Value Then           
                      'Enter date in Crated and Crate #
                      .Cells(i, 5) = [Text(Now(), &quot;DD-MM-YY HH:MM&quot;)]
                      .Cells(i, 6) = CrateTxt.Value
                      Exit For
                  End If
              End If
  
          Next
      End With
  
  End Sub
  </code></pre>