+ Reply to Thread
Results 1 to 2 of 2

Move Rows

  1. #1
    hfazal
    Guest

    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. #2
    Valued Forum Contributor
    Join Date
    04-11-2006
    Posts
    407
    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

    Quote Originally Posted by hfazal
    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

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1