title: How to update data using vba excel
body: <p>Can someone please help me to correct my code as I can't make my update button in userform works. Below are my code:</p>
  
  <pre><code>Private Sub CommandButton_update_Click()
  Dim cNum As Integer
  Dim x As Integer
  Dim nextrow As Range
  
  cNum = 7
  Set nextrow = Sheet1.Cells(Rows.Count, 3).End(xlUp).Offset(1, 0)
  For x = 1 To cNum
  nextrow = Me.Controls("TextBox" &amp; x).Value
  Set nextrow = nextrow.Offset(0, 1)
  Next
  MsgBox "Sent"
  'Clear Control
  cNum = 7
  For x = 1 To cNum
  For x = 1 To cNum
  nextrow = Me.Controls("TextBox" &amp; x).Value = ""
  Set nextrow = nextrow.Offset(0, 1)
  Next
  
  End Sub
  </code></pre>