Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Deleting the text without deleting the formula | Excel Worksheet Functions | |||
Deleting cell data without deleting formula | Excel Discussion (Misc queries) | |||
deleting values in a worksheet without deleting the formulas | Excel Worksheet Functions | |||
how prevent formula in cell from deleting when deleting value???? | New Users to Excel | |||
Deleting Hyphens or Dashes from multiple cells without deleting the remaining content | Excel Programming |