I am trying to cut and paste a selected row to the very last row of the data.
I am doing this by selecting a row featured in a listbox. If I click CommandButton3, it is supposed to cut the corresponding row of data and paste it to the very last row of the cells.
This is my code (which is not working):
Private Sub CommandButton3_Click()
Dim i As Integer
For i = 1 To Range("A10000").End(xlUp).Row
If Cells(i, 1) = ListBox1.List(ListBox1.ListIndex) Then
Rows(i).Select
Selection.Cut
Cells(Range("A10000").End(xlUp).Row + 1, 1).Select
Selected.Paste
End If
Next i
End Sub
I don't understand why Selected.Paste line does not work. Am I missing something here?