Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default cut and return

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?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 128
Default cut and return

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 128
Default cut and return

Hi Again,

forgot you want to return to sheet1

put
sheet1.select
at the bottom

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default cut and return

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

"Luis A. Vázquez" wrote in message
ups.com...
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?


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default cut and return

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
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
Return date if in range, else return blank LisaL Excel Worksheet Functions 1 July 22nd 09 03:23 PM
Compare Value in Cell 1 to a List, Return Value if Match otherwise Return Null Ben Excel Discussion (Misc queries) 2 March 15th 07 01:02 AM
LOOKUP and return the column heading for IF/THEN return for False NN Excel Discussion (Misc queries) 1 October 6th 06 11:24 AM
check if reference exists, then return its value or return 0 doudou Excel Worksheet Functions 1 June 4th 05 09:17 PM
VBA Syntax for VLOOKUP to return array of return values Alan Beban[_3_] Excel Programming 7 August 5th 03 11:41 AM


All times are GMT +1. The time now is 03:45 AM.

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"