bobshah2010
New Member
- Joined
- Nov 29, 2016
- Messages
- 39
I need to create a macro that goes through a list and arranges the values in that list in a 3 3 2 fashion based on a set criteria.
For example:
the list is:
A
B
C
D
E
F
G
H
and the criteria is:
A,B,D,G,H can only be in column 1 or 3
C,E can only be in column 1 and 2
F can be in column 2 and 3
This criteria is set by a condition - If flag is 1, then the letter can be in the respective column 1, 2 or 3 as below. E.g A can only be found in column 1 and 3, E can only be in column 1 and 2 etc....[TABLE="class: outer_border, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]Column1[/TD]
[TD]Column 2[/TD]
[TD]Column 3[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]D[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]E[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]F[/TD]
[TD]0[/TD]
[TD]1[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]G[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]H[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]1[/TD]
[/TR]
</tbody>[/TABLE]
Im expecting that the macro will cycle through the list and generate something like below (on the same sheet preferably, but anywhere is also good):
[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]Column 1[/TD]
[TD]Column 2[/TD]
[TD]Column 3[/TD]
[TD]Column 1[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]A[/TD]
[TD]E[/TD]
[TD]D[/TD]
[TD]H[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]B[/TD]
[TD]F[/TD]
[TD]G[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]C[/TD]
[TD]Err[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
The 'Err' is a result from there not being any option to put into that space (without reusing a previous letter - however this should not happen)_- Would like this feature in the macro.
And also note how the 3rd column only has 2 values, and the next available input goes into the 4th column - Would like to have this pattern repeated indefinitely.
Any help will be much appreciated - I know this is a complicated task and i'm expecting a few further clarifications but i'm hopeful someone here has a possible suggestion on how i might be able to do this.
Just FYI, the above list is much longer - say about 50 rows.. kept it to 8 rows to explain how i expect the macro to work.
Thanks so much!
For example:
the list is:
A
B
C
D
E
F
G
H
and the criteria is:
A,B,D,G,H can only be in column 1 or 3
C,E can only be in column 1 and 2
F can be in column 2 and 3
This criteria is set by a condition - If flag is 1, then the letter can be in the respective column 1, 2 or 3 as below. E.g A can only be found in column 1 and 3, E can only be in column 1 and 2 etc....[TABLE="class: outer_border, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]Column1[/TD]
[TD]Column 2[/TD]
[TD]Column 3[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]D[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]E[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]F[/TD]
[TD]0[/TD]
[TD]1[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]G[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]H[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]1[/TD]
[/TR]
</tbody>[/TABLE]
Im expecting that the macro will cycle through the list and generate something like below (on the same sheet preferably, but anywhere is also good):
[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]Column 1[/TD]
[TD]Column 2[/TD]
[TD]Column 3[/TD]
[TD]Column 1[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]A[/TD]
[TD]E[/TD]
[TD]D[/TD]
[TD]H[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]B[/TD]
[TD]F[/TD]
[TD]G[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]C[/TD]
[TD]Err[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
The 'Err' is a result from there not being any option to put into that space (without reusing a previous letter - however this should not happen)_- Would like this feature in the macro.
And also note how the 3rd column only has 2 values, and the next available input goes into the 4th column - Would like to have this pattern repeated indefinitely.
Any help will be much appreciated - I know this is a complicated task and i'm expecting a few further clarifications but i'm hopeful someone here has a possible suggestion on how i might be able to do this.
Just FYI, the above list is much longer - say about 50 rows.. kept it to 8 rows to explain how i expect the macro to work.
Thanks so much!