title: Copying Selective Rows from Sheet1 to Sheet2
body: <p>Hi all I need to selectively copy entire rows from sheet1 to other sheet. As of now I am using checkboxes to select the rows and then copy the selected rows to sheet of user's choice. But I am facing a bizarre error. For sometime the code runs fine, copying exact data to sheets but after some time it copies erroneous values from nowhere. Can you please help me with this? Pasting the code I am using.</p>
  
  <pre><code>Sub Addcheckboxes()
  Dim cell, LRow As Single
  Dim chkbx As CheckBox
  Dim MyLeft, MyTop, MyHeight, MyWidth As Double
  
  Application.ScreenUpdating = False
  LRow = ActiveSheet.Range("A" &amp; Rows.Count).End(xlUp).Row
  
  For cell = 2 To LRow
      If Cells(cell, "A").Value &lt;&gt; "" Then
          MyLeft = Cells(cell, "E").Left
          MyTop = Cells(cell, "E").Top
          MyHeight = Cells(cell, "E").Height
          MyWidth = Cells(cell, "E").Width
          ActiveSheet.CheckBoxes.Add(MyLeft, MyTop, MyWidth, MyHeight).Select
          With Selection
              .Caption = ""
              .Value = xlOff
              .Display3DShading = False
          End With
      End If
  Next cell
  
  Application.ScreenUpdating = True
  End Sub
  
  
  Sub RemoveCheckboxes()
  Dim chkbx As CheckBox
  For Each chkbx In ActiveSheet.CheckBoxes
      chkbx.Delete
  Next
  End Sub
  
  
  Sub CopyRows()
  Dim Val As String
  Val = InputBox(Prompt:="Sheet name please.", _
            Title:="ENTER SHEET NAME", Default:="Sheet Name here")
  For Each chkbx In ActiveSheet.CheckBoxes
      If chkbx.Value = 1 Then
          For r = 1 To Rows.Count
              If Cells(r, 1).Top = chkbx.Top Then
                  With Worksheets(Val)
                      LRow = .Range("A" &amp; Rows.Count).End(xlUp).Row + 1
                      .Range("A" &amp; LRow &amp; ":AF" &amp; LRow) = _
                      Worksheets("Usable_Inv_Data").Range("A" &amp; r &amp; ":AF" &amp; r).Value
                  End With
                  Exit For
              End If
          Next r
      End If
  Next
  End Sub
  </code></pre>
  
  <p>Normal Copy Output:
  <img src="https://i.stack.imgur.com/djT9z.png" alt="enter image description here"></p>
  
  <p>Erroneous Copy Output for same values:
  <img src="https://i.stack.imgur.com/csJiI.png" alt="enter image description here"></p>