cut and return

  • Thread starter =?iso-8859-1?q?Luis_A=2E_V=E1zquez?=
  • Start date
?

=?iso-8859-1?q?Luis_A=2E_V=E1zquez?=

i have this simple code.

all it does is cut the selection copy it on another page and return to
the original page. when back in the original page it should delete the
empty row that is left from the cut.

it does the job but is giving me debug error.

Sub updated()
Selection.Cut
Sheets("Sheet2").Select
Rows("1:1").Select
Selection.Insert Shift:=xlDown
Sheets("sheet1").Select
Selection.Delete.Row

End Sub

ideas?
 
C

Crowbar via OfficeKB.com

Your problem is the last row of code. You have not declared a section for it
to delete.

I have altered this to delete row 1 which causes no problems.

Sub updated()
Selection.Cut
Sheets("Sheet2").Select
Rows("1:1").Insert Shift:=xlDown
Sheets("sheet1").Rows("1:1").Delete

End Sub
 
C

Crowbar via OfficeKB.com

Hi Again,

forgot you want to return to sheet1

put
sheet1.select
at the bottom
 
D

Don Guillett

I am making an assumption that you want to move the entire row. Select any
cell on the desired row and fire this.
You need NOT goto the destination sheet.

Sub cutrowtosheet()
mr = ActiveCell.Row
Rows(mr).EntireRow.Cut
Sheets("sheet2").Rows(1).Insert shift:=xlDown
Rows(mr).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