Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Moving The Selected Record From One Sheet To Another


Hi everybody,

I have a sheet contains lots of records, some of these records are old
and not needed , so I want to transfer them to another sheet in order
to go back to them in the future.

I would like you please to provide me with a VBA code works on moving
the whole record to the other sheet when I select any cell of that
record

I hope that my question is clear for you,

thank you,


--
LoveCandle
------------------------------------------------------------------------
LoveCandle's Profile: http://www.excelforum.com/member.php...o&userid=28612
View this thread: http://www.excelforum.com/showthread...hreadid=497490

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Moving The Selected Record From One Sheet To Another

Hi
Here is piece of VB code to solve ur problem. Hope you are able to put
this code in your file and run it.

Just copy paste the following code in your workbook module in Visual
Basic Editor available under ToolsMacros Visual Basic Editor.

Now go to the sheet that contains the data and double click any cell in
your old record (I have assumed that you have one record in one row).
This record is cut from this sheet and pasted in the next sheet.
Please note that this code will suppress the double click function in
this excel file of yours. Also make sure that the sheet following your
data sheet is a new sheet; as it's this new sheet where old records
will be dumped. And before you start take a backup of ur original file.


Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal
Target As Range, Cancel As Boolean)
Rows(ActiveCell.Row).Select
Selection.Cut
ActiveSheet.Next.Select
ActiveSheet.UsedRange.SpecialCells(xlLastCell).Sel ect
Row = ActiveCell.Row + 1
Range("A" & Row).Select
ActiveSheet.Paste
Range("A" & Row).Select
Application.CutCopyMode = False
ActiveSheet.Previous.Select
Selection.Delete Shift:=xlUp
ActiveCell.Select
End Sub


Thanks Karthik Bhat

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Moving The Selected Record From One Sheet To Another


Thank you for ur reply,

I tested the code you delivered but it stops at the following line:

Range("A" & Row).Select

On another hand, I think the code you delivered works on cutting the
whole row and paste it in another sheet, while I want the code to copy
the current record and paste it in the other sheet then clearing the
contents of the copied record in order for me re-fill it again.

I hope that you got my point.

Thanks,


--
LoveCandle
------------------------------------------------------------------------
LoveCandle's Profile: http://www.excelforum.com/member.php...o&userid=28612
View this thread: http://www.excelforum.com/showthread...hreadid=497490

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Moving The Selected Record From One Sheet To Another

Hi

Try this

Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal
Target As Range, Cancel As Boolean)
Rows(ActiveCell.Row).Select
Selection.Cut
ActiveSheet.Next.Select
ActiveSheet.UsedRange.SpecialCells(xlLastCell).Sel ect
Row = ActiveCell.Row + 1
Cells(Row, 1).Select
ActiveSheet.Paste
Cells(Row, 1).Select
Application.CutCopyMode = False
ActiveSheet.Previous.Select
'Selection.Delete Shift:=xlUp
'ActiveCell.Select
End Sub

Thanks
Karthik Bhat

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
Open new record with selected fields from previous record Design by Sue Excel Discussion (Misc queries) 1 June 12th 09 02:24 PM
Duplicate sheet, autonumber sheet, record data on another sheet des-sa[_2_] Excel Worksheet Functions 0 May 8th 08 06:56 PM
Moving Selected Fields to Summary Sheet Les Linton Excel Discussion (Misc queries) 1 January 10th 08 12:38 PM
how do i make it so that when a sheat is selected either via link or tab, that xlLastCell is selected. the last on the sheet. Daniel Excel Worksheet Functions 1 July 12th 05 01:30 AM
How to record macro to work on selected column/row? Olezhka Excel Programming 1 March 5th 04 07:30 PM


All times are GMT +1. The time now is 06:59 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"