Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 104
Default Deleting a row

Hello,

I have a macro that finds a specific value in column one, cuts the entire
row and then pastes it to a specified location within the same sheet.

My only problem is that I need to delete the row from where I have cut the
record. The macro is essentially a report formatter and so there are
deliberate blank lines through the report. How can I cut a row of
information, paste it and then go back to the same row to delete it?

--
Thanks in advance,
MarkN
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Deleting a row


If the row you copied from was say 10 then why not

Rows("10:10").Select
Selection.Delete

This should work, unless you have something else in your mind.

A V Veerkar


--
avveerkar
------------------------------------------------------------------------
avveerkar's Profile: http://www.excelforum.com/member.php...o&userid=30338
View this thread: http://www.excelforum.com/showthread...hreadid=508852

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Deleting a row


Hi Mark,
Have a play with incorporating the following into your code:

(Paste following 2 lines at top of macro)
Dim RowToCopy As Long
Dim RowToPasteTo As Long

(Paste the following into the copy & paste area of the macro)
RowToCopy = ActiveCell.Row 'change as needed
RowToPasteTo = 23 'change as needed
Rows(RowToCopy).Copy Range("A" & RowToPasteTo)
Rows(RowToCopy).Delete

Note, the lines "RowToCopy = "... & "RowToPasteTo ="... need to be
changed to suit your needs. This code results in the row immediately
below the copied row becoming the active one after the copied one has
been deleted.

hth,
Rob Brockett
NZ
always learning & the best way to learn is to experience...


--
broro183
------------------------------------------------------------------------
broro183's Profile: http://www.excelforum.com/member.php...o&userid=30068
View this thread: http://www.excelforum.com/showthread...hreadid=508852

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 104
Default Deleting a row

Hi Rob,

Thanks very much, after some tweaking your suggestion worked well.
--
Thanks again,
MarkN


"broro183" wrote:


Hi Mark,
Have a play with incorporating the following into your code:

(Paste following 2 lines at top of macro)
Dim RowToCopy As Long
Dim RowToPasteTo As Long

(Paste the following into the copy & paste area of the macro)
RowToCopy = ActiveCell.Row 'change as needed
RowToPasteTo = 23 'change as needed
Rows(RowToCopy).Copy Range("A" & RowToPasteTo)
Rows(RowToCopy).Delete

Note, the lines "RowToCopy = "... & "RowToPasteTo ="... need to be
changed to suit your needs. This code results in the row immediately
below the copied row becoming the active one after the copied one has
been deleted.

hth,
Rob Brockett
NZ
always learning & the best way to learn is to experience...


--
broro183
------------------------------------------------------------------------
broro183's Profile: http://www.excelforum.com/member.php...o&userid=30068
View this thread: http://www.excelforum.com/showthread...hreadid=508852


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Deleting a row


Hi Mark,
Pleased I could help :-)

Rob Brockett
NZ
always learning & the best way to learn is to experience...


--
broro183
------------------------------------------------------------------------
broro183's Profile: http://www.excelforum.com/member.php...o&userid=30068
View this thread: http://www.excelforum.com/showthread...hreadid=508852



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
Deleting the text without deleting the formula gems04 Excel Worksheet Functions 3 January 30th 09 11:21 PM
Deleting cell data without deleting formula Tom Hall Excel Discussion (Misc queries) 4 October 29th 06 04:07 PM
deleting values in a worksheet without deleting the formulas patti Excel Worksheet Functions 1 October 28th 05 09:49 PM
how prevent formula in cell from deleting when deleting value???? sh-boom New Users to Excel 1 September 30th 05 06:12 PM
Deleting Hyphens or Dashes from multiple cells without deleting the remaining content rmaloy Excel Programming 5 February 9th 04 01:59 AM


All times are GMT +1. The time now is 11:22 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"