Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I want to move rows with with a certain word in column A to the bottom of all the rows. How can I do that in a macro? Also, the table is already sorted by other columns, I don't want to screw up this sorting, I just want to move rows that have certain input in column A to the bottom of the table... any ideas? Thanks H |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Change "TriggerWord" to whatever it is that signifies that it is to be moved to the bottom. Also, this is assuming there are no blank fields in your Table in Column A and that there are no cells populated below the table. Hope this helps. Sub SortColmnA() ActiveSheet.Range("A1").Activate vTrgr = "TriggerWord" row2 = 1 Do If UCase(ActiveCell) < UCase(vTrgr) Then ActiveCell.Offset(1, 0).Activate Else row1 = ActiveCell.EntireRow.Address ActiveCell.Offset(1, 0).Activate If row2 < 1 Then row2 = row2 + "," + row1 Else row2 = row1 End If End If Loop Until IsEmpty(ActiveCell) = True row3 = ActiveCell.Address Range(row2).Copy Range(row3).PasteSpecial Range(row2).Delete Range("A1").Activate End Sub hfazal Wrote: Hi, I want to move rows with with a certain word in column A to the bottom of all the rows. How can I do that in a macro? Also, the table is already sorted by other columns, I don't want to screw up this sorting, I just want to move rows that have certain input in column A to the bottom of the table... any ideas? Thanks H -- Ikaabod ------------------------------------------------------------------------ Ikaabod's Profile: http://www.excelforum.com/member.php...o&userid=33371 View this thread: http://www.excelforum.com/showthread...hreadid=534596 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Sort rows and move borders with rows | New Users to Excel | |||
Move cursor 5 rows down | Excel Discussion (Misc queries) | |||
How do I move up rows below blank rows in an address? | Excel Worksheet Functions | |||
Move Rows & Append | Excel Programming | |||
how to move up and down different rows? | Excel Programming |