flyfisher65
New Member
- Joined
- Aug 7, 2011
- Messages
- 3
language: VBA
I am trying to create a vba macro that will sort a jagged array (an array containing other arrays) by the elements of the first array. I want to keep the move the rest of the data in the "smaller" arrays with the column being sorted. This process is looped several times. Im not sure exactly how to describe it, but I tried to visualize it in the example below. I am not familiar with sorting code and would like some help on what to do. I tried putting it into an new worksheet and sorting it in excell, but some of the outputs (there are several because of the loop) were increasing L-R while others were deceasing. I want them to increase but am not sure how to do this.
Example (each character represents and element in the jagged array () encloses one of the "smaller" arrays)
(1AAAAA)
(4DDDDD)
(3CCCCC)
(2BBBBB)
would sort to
(1AAAAA)
(2BBBBB)
(3CCCCC)
(4DDDDD)
problem:
some outputs end up like this
(4DDDDD)
(3CCCCC)
(2BBBBB)
(1AAAAA)
thanks in advance
-Lewis
I am trying to create a vba macro that will sort a jagged array (an array containing other arrays) by the elements of the first array. I want to keep the move the rest of the data in the "smaller" arrays with the column being sorted. This process is looped several times. Im not sure exactly how to describe it, but I tried to visualize it in the example below. I am not familiar with sorting code and would like some help on what to do. I tried putting it into an new worksheet and sorting it in excell, but some of the outputs (there are several because of the loop) were increasing L-R while others were deceasing. I want them to increase but am not sure how to do this.
Example (each character represents and element in the jagged array () encloses one of the "smaller" arrays)
(1AAAAA)
(4DDDDD)
(3CCCCC)
(2BBBBB)
would sort to
(1AAAAA)
(2BBBBB)
(3CCCCC)
(4DDDDD)
problem:
some outputs end up like this
(4DDDDD)
(3CCCCC)
(2BBBBB)
(1AAAAA)
thanks in advance
-Lewis