#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Move Rows

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Move Rows


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
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
Sort rows and move borders with rows [email protected] New Users to Excel 1 June 4th 09 07:36 AM
Move cursor 5 rows down Tracy Excel Discussion (Misc queries) 1 September 26th 08 05:14 PM
How do I move up rows below blank rows in an address? goggem Excel Worksheet Functions 0 May 17th 05 04:01 AM
Move Rows & Append James[_36_] Excel Programming 0 April 13th 05 04:18 PM
how to move up and down different rows? Rana Mubasir Mehmood Excel Programming 1 November 25th 04 12:00 AM


All times are GMT +1. The time now is 01:21 PM.

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"