title: Excel VBA code understanding
body: <p>I'm trying build a excel based input form, I have found something online and I'm trying to understand these codes:</p>
  
  <pre><code>Dim Hsheet,Isheet As Worksheet
  Dim NextRow, oCol As Long
  Dim MyRng, MyCell As Range
  Dim MyCopy, ClearCells As String
  
  Set Hsheet = Worksheet("InputForm")
  Set ISheet = Worksheet("Database")
  </code></pre>
  
  <p><strong>This is the part I don't understand, can someone explain to me please?</strong></p>
  
  <hr>
  
  <pre><code>With Hsheet
       nextRow = .Cells(.Rows.Count, "A").End(xlUp).Offset(1, 0).Row
  End With
  </code></pre>
  
  <hr>
  
  <pre><code>With Isheet
      Set myRng = .Range(MyCopy)
  
      If Application.CountA(myRng) &lt;&gt; myRng.Cells.Count Then
          MsgBox "Please fill in all the cells!"
          Exit Sub
      End If
  End With
  </code></pre>
  
  <p><strong>And also this part, can someone explain to me please?</strong></p>
  
  <pre><code>With Hsheet
      .Cells(nextRow, "a").Value = Application.UserName
      oCol = 1
      For Each myCell In MyRng.Cells
          Hsheet.Cells(NextRow, oCol).Value = myCell.Value
          oCol = oCol + 1
      Next myCell
  End With
  </code></pre>
  
  <p>Thanks in advance :)</p>
  
  <pre><code>With Isheet
    On Error Resume Next
       With .Range(ClearCells).Cells.SpecialCells(xlCellTypeConstants)
            .ClearContents
            Application.Goto .Cells(1) ', Scroll:=True
       End With
    On Error GoTo 0
  End With
  </code></pre>