pgspringer
New Member
- Joined
- Nov 10, 2014
- Messages
- 4
Hello,
I am working on a To-Do list in Excel 2010. I am running into a paste range class invalid error. I am relatively new to VBA working off macros and google.
The part I am having trouble with is moving the completed tasks to another table in the sheet, the code I currently have is this
Sub MoveCompleted()
Dim LastRow As Variant
Set LastRow = ActiveSheet.ListObjects("Table710").ListRows.Add
ActiveSheet.ListObjects("Table7").Range.AutoFilter Field:=5, Criteria1:="Completed"
ActiveSheet.ListObjects("Table7").DataBodyRange.Copy
ActiveSheet.ListObjects("Table7").Range.AutoFilter Field:=5
LastRow.Range.PasteSpecial xlPasteValues
End Sub
Right now I am not worried about deleting the original data from Table7, I figured I would worry about that later.
Everything works up until paste. My thought is because I am only adding one row and the data copied is potentially more than one, but I do not have the knowledge of how to proceed. Any help would be wonderfully obliged.
Thank You!
Also working on Windows 7 - 64bit.
I am working on a To-Do list in Excel 2010. I am running into a paste range class invalid error. I am relatively new to VBA working off macros and google.
The part I am having trouble with is moving the completed tasks to another table in the sheet, the code I currently have is this
Sub MoveCompleted()
Dim LastRow As Variant
Set LastRow = ActiveSheet.ListObjects("Table710").ListRows.Add
ActiveSheet.ListObjects("Table7").Range.AutoFilter Field:=5, Criteria1:="Completed"
ActiveSheet.ListObjects("Table7").DataBodyRange.Copy
ActiveSheet.ListObjects("Table7").Range.AutoFilter Field:=5
LastRow.Range.PasteSpecial xlPasteValues
End Sub
Right now I am not worried about deleting the original data from Table7, I figured I would worry about that later.
Everything works up until paste. My thought is because I am only adding one row and the data copied is potentially more than one, but I do not have the knowledge of how to proceed. Any help would be wonderfully obliged.
Thank You!
Also working on Windows 7 - 64bit.