ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Copy current row to clipboard and delete row (https://www.excelbanter.com/excel-discussion-misc-queries/184377-copy-current-row-clipboard-delete-row.html)

GKW in GA

Copy current row to clipboard and delete row
 
I would like to create a macro that will copy the row of the cell that the
cursor is currently in and delete that row.

How to do?

Mike H

Copy current row to clipboard and delete row
 
Hi,

The 2 lines below will do what you require but you need to do something in
between because when you delete the row you lose the copied data.

ActiveCell.EntireRow.Copy
'Do something with the copied data i.e paste it somewhere else
ActiveCell.EntireRow.Delete

Mike

"GKW in GA" wrote:

I would like to create a macro that will copy the row of the cell that the
cursor is currently in and delete that row.

How to do?


James Silverton[_2_]

Copy current row to clipboard and delete row
 
Mike wrote on Sat, 19 Apr 2008 06:52:00 -0700:

MH The 2 lines below will do what you require but you need to
MH do something in between because when you delete the row you
MH lose the copied data.

MH ActiveCell.EntireRow.Copy
MH 'Do something with the copied data i.e paste it somewhere
MH else ActiveCell.EntireRow.Delete

MH Mike

MH "GKW in GA" wrote:

?? I would like to create a macro that will copy the row of
?? the cell that the cursor is currently in and delete that
?? row.

The number of modifications that are available in VBA for
ActiveCell is amazing to me. Can you (or anyone else) suggest a
good book with a reasonably complete list of functions,
prefererably one that also teaches VBA for Excel?


James Silverton
Potomac, Maryland

E-mail, with obvious alterations:
not.jim.silverton.at.verizon.not


Mike H

Copy current row to clipboard and delete row
 
Hi,

The activecell statement returns a range object and you can apply any of the
properties or methods of a range object to the active cell.

With regard to a book the one produced by John Walkenbach is one I found and
still find invaluable.

http://www.amazon.com/Excel-2003-Bib.../dp/0764539671

Mike

"James Silverton" wrote:

Mike wrote on Sat, 19 Apr 2008 06:52:00 -0700:

MH The 2 lines below will do what you require but you need to
MH do something in between because when you delete the row you
MH lose the copied data.

MH ActiveCell.EntireRow.Copy
MH 'Do something with the copied data i.e paste it somewhere
MH else ActiveCell.EntireRow.Delete

MH Mike

MH "GKW in GA" wrote:

?? I would like to create a macro that will copy the row of
?? the cell that the cursor is currently in and delete that
?? row.

The number of modifications that are available in VBA for
ActiveCell is amazing to me. Can you (or anyone else) suggest a
good book with a reasonably complete list of functions,
prefererably one that also teaches VBA for Excel?


James Silverton
Potomac, Maryland

E-mail, with obvious alterations:
not.jim.silverton.at.verizon.not



James Silverton[_2_]

Copy current row to clipboard and delete row
 
Mike wrote on Sat, 19 Apr 2008 07:22:00 -0700:

MH The activecell statement returns a range object and you can
MH apply any of the properties or methods of a range object to
MH the active cell.

MH With regard to a book the one produced by John Walkenbach
MH is one I found and still find invaluable.

MH
http://www.amazon.com/Excel-2003-Bib.../dp/0764539671

MH Mike

Thanks, that looks like a good bet. I've used his "Excel 2002
formulas" for a long time; so much so that I have the PDF
version on disk.


James Silverton
Potomac, Maryland

E-mail, with obvious alterations:
not.jim.silverton.at.verizon.not



All times are GMT +1. The time now is 08:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com