PC Review


Reply
Thread Tools Rate Thread

cut and return

 
 
=?iso-8859-1?q?Luis_A=2E_V=E1zquez?=
Guest
Posts: n/a
 
      16th Oct 2007
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?

 
Reply With Quote
 
 
 
 
Crowbar via OfficeKB.com
Guest
Posts: n/a
 
      16th Oct 2007
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

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200710/1

 
Reply With Quote
 
Crowbar via OfficeKB.com
Guest
Posts: n/a
 
      16th Oct 2007
Hi Again,

forgot you want to return to sheet1

put
sheet1.select
at the bottom

--
Message posted via http://www.officekb.com

 
Reply With Quote
 
Don Guillett
Guest
Posts: n/a
 
      16th Oct 2007
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

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(E-Mail Removed)
"Luis A. Vázquez" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>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?
>


 
Reply With Quote
 
=?iso-8859-1?q?Luis_A=2E_V=E1zquez?=
Guest
Posts: n/a
 
      16th Oct 2007
On Oct 16, 3:07 pm, "Crowbar via OfficeKB.com" <u15117@uwe> wrote:
> Hi Again,
>
> forgot you want to return to sheet1
>
> put
> sheet1.select
> at the bottom
>
> --
> Message posted viahttp://www.officekb.com


Thanks to both.

Works fine

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Search and replace hard-line-return character, not carriage return =?Utf-8?B?VHlsZXIgVA==?= Microsoft Word Document Management 2 16th Aug 2006 09:11 PM
Serialize a class having property that return object as return type surindersaini@gmail.com Microsoft C# .NET 4 24th Oct 2005 03:23 PM
VBA to apply a Soft Return (or Hard Return) at end of wrapped line Dennis Microsoft Word Document Management 7 14th May 2005 07:01 AM
Userenv 1000. Windows cannot determine the user or computer name. Return value (<return error code>). Ingmar Microsoft Windows 2000 Networking 1 18th Nov 2003 05:08 PM
Userenv 1000. Windows cannot determine the user or computer name. Return value (<return error code>). Ingmar Microsoft Windows 2000 Group Policy 1 18th Nov 2003 05:08 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:13 AM.