Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default Command button to move completed action item

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,
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Command button to move completed action item

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

On Mon, 4 Feb 2008 12:14:02 -0800, JFREE223
wrote:

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,


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,942
Default Command button to move completed action item

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
"JFREE223" wrote:

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,

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Command button to move completed action item

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

JFREE223 wrote:

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,


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default Command button to move completed action item

Works Perfectly. Thanks to the both of you for your suggestions.

"JFREE223" wrote:

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,

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Undo delete button action lwj Excel Worksheet Functions 0 June 15th 07 03:33 PM
Action Item Worksheet Creation Kevin M[_2_] Excel Worksheet Functions 0 February 26th 07 09:16 PM
Trigger Action when Standard Menu Item Selected? Filibuster Excel Discussion (Misc queries) 2 July 26th 06 12:49 AM
How do I create an action button in excel? Ian G Excel Discussion (Misc queries) 1 November 8th 05 12:33 AM
command button in excel will move when print. [email protected] Excel Discussion (Misc queries) 1 December 29th 04 03:53 PM


All times are GMT +1. The time now is 12:54 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"