-
Need help in excel
Hi I want to ask how I can change the Columns left to right, right to left
and also row Up to down, down to up. for example I have text in Excel
sheet like this:
EXAMPLE – 1 Column Left - Right
[ ][ A ][ B ][ C ][ D ][ E ][ F ]
[ 1 ] Aa Ba Ca Da Ea Fa
[ 2 ] Ab Bb Cb Db Eb Fb
[ 3 ] Ac Bc Cc Dc Ec Fc
And I want to change lift to right like this.
[ ][ A ][ B ][ C ][ D ][ E ][ F ]
[ 1 ] Fa Ea Da Ca Ba Aa
[ 2 ] Fb Eb Db Cb Bb Ab
[ 3 ] Fc Ec Dc Cc Bc Ac
EXAMPLE – 2 Row Up - Down
[ ][ A ][ B ][ C ][ D ][ E ][ F ]
[ 1 ] Aa Ab Ac
[ 2 ] Ba Bb Bc
[ 3 ] Ca Cb Cc
[ 4 ] Da Db Dc
[ 5 ] Ea Eb Ec
[ 6 ] Fa Fb Fc
And I want to change up to down like this.
[ ][ A ][ B ][ C ][ D ][ E ][ F ]
[ 1 ] Fa Fb Fc
[ 2 ] Ea Eb Ec
[ 3 ] Da Db Dc
[ 4 ] Ca Cb Cc
[ 5 ] Ba Bb Bc
[ 6 ] Aa Ab Ac
I hope my question is understandable, please tell me that it is possible
or no?
Thank you for your attention.
-
Re: Need help in excel
You can do each one by invoking the .Sort method f the range.
-
Re: Need help in excel
csKanna:
I don't know if RobDog helped you or not, but here is a simple code loop to reverse any number of columns starting with Column A:
Code:
Option Explicit
Sub ReverseColumns()
Dim numCols As Integer ' Number of Columns to roll
Dim i As Integer
'Set the number of Columns to Roll
numCols = 6
'Iterate through the Columns rolling column A into the correct location
For i = (numCols + 1) To 3 Step -1
Columns(1).Cut
Cells(1, i).Insert Shift:=xlToRight
Next i
End Sub
Can you figure out the loop for Rows? We'll help you with that as well if you need it, but we will need to know how you plan to determine the number of rows to invert.
Of course you can easily pass the 'Number of Columns' as a parameter to this function.