title: VBA error: Application defined or object defined error
body: <p>Hey I am getting this error in excel: application defined of object defined error</p>
  
  <pre><code>Private Sub CommandButton1_Click()
  Dim r1 As Range
  Dim r2 As Range
  Dim a As Integer
  Dim b As Integer
  b = 1
  
  Set r2 = Range("a1:a100")
  
  For Each r1 In r2.Cells
     If r1.Value = "hummer1" Then
      a = r1.Row
      Range(Cells(a, 1), Cells(a, 5)).Copy
      Sheets("Sheet2").Range(Cells(b, 1), Cells(b, 1)).Paste    "line with the error"
      b = b + 1
     End If
  Next r1
  
  End Sub
  </code></pre>
  
  <p>it looks very simple but I was unable to figure out what is the problem</p>