Consulting

Results 1 to 2 of 2

Thread: Solved: Reversing the order of rows???

  1. #1
    VBAX Regular
    Joined
    Feb 2009
    Posts
    22
    Location

    Solved: Reversing the order of rows???

    Hi experts,
    I have found out through this forum that I can reverse the order of columns using this code;

    [vba]
    Sub reverse()
    Dim counti As Integer
    Dim countj As Integer

    Application.ScreenUpdating = False
    counti = Cells(Selection.Row, Columns.Count).End(xlToLeft).Column
    For countj = counti - 1 To 1 Step -1
    Columns(countj).Cut
    Columns(counti + 1).Insert
    Next countj
    Application.ScreenUpdating = True
    End Sub
    [/vba]

    Is anyone able to provide me with some code to reverse the order of rows?

    Thanks in advance

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    Sub reverse()
    Dim counti As Integer
    Dim countj As Integer
    Application.ScreenUpdating = False
    counti = Cells(Rows.Count, Selection.Column).End(xlUp).Row
    For countj = counti - 1 To 1 Step -1
    Rows(countj).Cut
    Rows(counti + 1).Insert
    Next countj
    Application.ScreenUpdating = True
    End Sub
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

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