I have essentially no experience with VBA. Just trying to copy data from one table and insert into a second table without copying over any data. It is copying the data and deleting the cells but it can't find the table to paste it in. Any assistance would be appreciated.
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
Dim Sheet1 As Worksheet
Dim Sheet2 As Worksheet
Dim Table2 As Range
Set Sheet1 = Worksheets("Sheet1")
Set Sheet2 = Worksheets("Sheet2")
Set Table2 = Range("a2:c10")
a = Sheet1.Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To a
If Sheet1.Cells(i, 2).Value = 1001 Then
Sheet1.Rows(i).Cut
Sheet2.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Paste
End If
Next
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub