PDA

View Full Version : reverse columns



lior03
12-06-2005, 12:58 AM
hello
is it possible to revers columns of a table in excel?
maybe like this

Sub reverse()
Application.ScreenUpdating = False
Dim counti As Integer
Dim countj As Integer
counti = Selection.End(xlToLeft).Column
For countj = 1 To counti - 1
Columns(counti).Cut
Columns(countj).Insert
Next countj
Application.ScreenUpdating = True
End Sub
it does not work.
why?

Bob Phillips
12-06-2005, 02:48 AM
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

twelvety
02-10-2009, 09:00 AM
In the same way that you have reversed the columns here is there any simple code to reverse the rows?