+ Reply to Thread
Results 1 to 5 of 5

Move row to the bottom of the list

Hybrid View

  1. #1
    Registered User
    Join Date
    06-12-2007
    Posts
    3

    Move row to the bottom of the list

    I want the moment that I insert a number >=12 on a cell for the complete row to move to the bottom of the list to the next available empty row.
    How can this be done?
    ---cjs

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Maybe an event macro which goes in the workbook module (See link)

    I've assumed you only want this to happen in 1 col. I've picked Col C. Just enter a value in say C3 and if you have rows complete below that it will move to the last row

    http://www.contextures.com/xlvba01.html#Worksheet

    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim last As Long
    last = Range("C65536").End(xlUp).Row
    If Target.Count > 1 Then Exit Sub
    If Not Intersect(Target, Range("C:C")) Is Nothing Then
    If Target.Value > = 12 Then
    Rows(Target.Row & ":" & Target.Row).Cut
    Rows(last + 1 & ":" & last + 1).Insert Shift:=xlDown
    End If
    End If
    
    End Sub
    or
    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim last As Long
    last = Range("C65536").End(xlUp).Row
    If Target.Count > 1 Then Exit Sub
    If Not Intersect(Target, Range("C:C")) Is Nothing Then
    If Target.Value > 12 Then
    Rows(last + 1 & ":" & last + 1).Value = Rows(Target.Row & ":" & Target.Row).Value
    Rows(Target.Row & ":" & Target.Row).Clear
    End If
    End If
    
    End Sub
    VBA Noob
    Last edited by VBA Noob; 06-12-2007 at 04:01 PM.
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Registered User
    Join Date
    06-12-2007
    Posts
    3

    Big time New Person

    How do I do that...can you please email me a spreadsheet with it already in it??

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    See link

    VBA Noob

  5. #5
    Registered User
    Join Date
    06-12-2007
    Posts
    3

    Two issues

    Thank in advance it is working...kindof.

    It will move the data...if any number in any column is over 12 also it dumps the row about 10 or 15 row below. How do I make it for 1 specific column or selective column? How do I have the macro constantly run? How do I force it to the line below the lowest?
    Thank you again in advance.

+ 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