Command button to move completed action item

J

JFREE223

I'm trying to move completed action items from one worksheet to another via a
command button on the excel page. The macro I have is...

Sub MoveCompletedTasks()

ActiveCell.Offset(0, 0).Rows("1:1").EntireRow.Select
Sheets("Closed Action Items").Select
ActiveCell.Rows("1:1").EntireRow.Select
Rows("4:4").Select
Sheets("Action Items").Select
Selection.Cut
Sheets("Closed Action Items").Select
Range("A1").End(xlDown).Offset(1, 0).Select
ActiveSheet.Paste
Sheets("Action Items").Select
ActiveCell.Offset(0, 0).Rows("1:1").EntireRow.Select
Selection.EntireRow.Delete


End Sub

I get "Error 400" after
Range("A1").End(xlDown).Offset(1, 0).Select

Any suggestions to move a completed task to another page is appreciated.
I'd like to avoid filtering...I'm trying to make it as 'manual' free as
possible.

Thanks,
 
G

Gord Dibben

You have so many extraneous and non-productive 'select" lines I'm not sure but
maybe this will work,

Sub Test()

Sheets("Action Items").Select
ActiveSheet.Range(ActiveCell, Cells(ActiveCell.Row, _
Columns.Count).End(xlToLeft)).Cut _
Destination:=Sheets("Closed Action Items") _
.Range("A1").End(xlDown).Offset(1, 0)

End Sub
 
F

FSt1

hi
you have a number of errors and redundencies in your code.
try something like this instead
ActiveCell.EntireRow.Copy
Sheets("Closed Action Items").Activate
ActiveSheet.Range("A1").End(xlDown).Offset(1, 0).PasteSpecial xlPasteAll
Sheets("Action Items").Activate
ActiveCell.EntireRow.Delete shift:=xlUp

regards
FSt1
 
D

Dave Peterson

One more...

Option Explicit
Sub MoveCompletedTasks2()

Dim RngToCopy As Range
Dim DestCell As Range

Set RngToCopy = ActiveCell.EntireRow

With Worksheets("Closed Action Items")
Set DestCell = .Cells(.Rows.Count, "A").End(xlUp).Offset(1, 0)
End With

RngToCopy.Copy _
Destination:=DestCell

RngToCopy.Delete

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top