S.H.A.D.O.
Well-known Member
- Joined
- Sep 6, 2005
- Messages
- 1,915
Good morning,
I have the following code which lists the output vertically, but I would like it to list the output horizontally please.
The first figure is the total Odd numbers for position 1, the second figure is the total Even numbers for position 1, and the third figure is the total Odd & Even numbers for position 1, and so on down for positions 2 to 6.
The information is output like so...
[TABLE="width: 48"]
<tbody>[TR]
[TD="class: xl65, width: 64, bgcolor: transparent, align: right"]16044
[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent, align: right"]11088
[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent, align: right"]27132
[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent, align: right"]13188
[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent, align: right"]13944
[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent, align: right"]27132
[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent, align: right"]13608
[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent, align: right"]13524
[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent, align: right"]27132
[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent, align: right"]13608
[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent, align: right"]13524
[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent, align: right"]27132
[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent, align: right"]13188
[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent, align: right"]13944
[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent, align: right"]27132
[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent, align: right"]16044
[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent, align: right"]11088
[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent, align: right"]27132
[/TD]
[/TR]
</tbody>[/TABLE]
...but I would like it like so...
[TABLE="width: 288"]
<tbody>[TR]
[TD="class: xl65, width: 64, bgcolor: transparent, align: right"]16044
[/TD]
[TD="class: xl65, width: 64, bgcolor: transparent, align: right"]13188
[/TD]
[TD="class: xl65, width: 64, bgcolor: transparent, align: right"]13608
[/TD]
[TD="class: xl65, width: 64, bgcolor: transparent, align: right"]13608
[/TD]
[TD="class: xl65, width: 64, bgcolor: transparent, align: right"]13188
[/TD]
[TD="class: xl65, width: 64, bgcolor: transparent, align: right"]16044
[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent, align: right"]11088
[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]13944
[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]13524
[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]13524
[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]13944
[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]11088
[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent, align: right"]27132
[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]27132
[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]27132
[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]27132
[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]27132
[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]27132
[/TD]
[/TR]
</tbody>[/TABLE]
Here is the code...
Any help will be appreciated, thanks in advance.
I have the following code which lists the output vertically, but I would like it to list the output horizontally please.
The first figure is the total Odd numbers for position 1, the second figure is the total Even numbers for position 1, and the third figure is the total Odd & Even numbers for position 1, and so on down for positions 2 to 6.
The information is output like so...
[TABLE="width: 48"]
<tbody>[TR]
[TD="class: xl65, width: 64, bgcolor: transparent, align: right"]16044
[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent, align: right"]11088
[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent, align: right"]27132
[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent, align: right"]13188
[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent, align: right"]13944
[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent, align: right"]27132
[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent, align: right"]13608
[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent, align: right"]13524
[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent, align: right"]27132
[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent, align: right"]13608
[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent, align: right"]13524
[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent, align: right"]27132
[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent, align: right"]13188
[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent, align: right"]13944
[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent, align: right"]27132
[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent, align: right"]16044
[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent, align: right"]11088
[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent, align: right"]27132
[/TD]
[/TR]
</tbody>[/TABLE]
...but I would like it like so...
[TABLE="width: 288"]
<tbody>[TR]
[TD="class: xl65, width: 64, bgcolor: transparent, align: right"]16044
[/TD]
[TD="class: xl65, width: 64, bgcolor: transparent, align: right"]13188
[/TD]
[TD="class: xl65, width: 64, bgcolor: transparent, align: right"]13608
[/TD]
[TD="class: xl65, width: 64, bgcolor: transparent, align: right"]13608
[/TD]
[TD="class: xl65, width: 64, bgcolor: transparent, align: right"]13188
[/TD]
[TD="class: xl65, width: 64, bgcolor: transparent, align: right"]16044
[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent, align: right"]11088
[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]13944
[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]13524
[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]13524
[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]13944
[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]11088
[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent, align: right"]27132
[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]27132
[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]27132
[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]27132
[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]27132
[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]27132
[/TD]
[/TR]
</tbody>[/TABLE]
Here is the code...
Code:
Option Explicit
Option Base 1
Const MinA As Integer = 1
Const MaxF As Integer = 59
Sub Odd_And_Even_By_Position()
Dim A As Long, B As Long, C As Long, D As Long, E As Long, F As Long
Dim nDist(1 To 18) As Double
Dim n As Integer
Dim i As Integer
With Application
.ScreenUpdating = False: .Calculation = xlCalculationManual: .DisplayAlerts = False
End With
Columns("A:C").ClearContents
Cells(1, 1).Select
For A = MinA To MaxF - 5
For B = A + 1 To MaxF - 4
For C = B + 1 To MaxF - 3
For D = C + 1 To MaxF - 2
For E = D + 1 To MaxF - 1
For F = E + 1 To MaxF
nDist(2 - (A Mod 2)) = nDist(2 - (A Mod 2)) + 1
nDist(5 - (B Mod 2)) = nDist(5 - (B Mod 2)) + 1
nDist(8 - (C Mod 2)) = nDist(8 - (C Mod 2)) + 1
nDist(11 - (D Mod 2)) = nDist(11 - (D Mod 2)) + 1
nDist(14 - (E Mod 2)) = nDist(14 - (E Mod 2)) + 1
nDist(17 - (F Mod 2)) = nDist(17 - (F Mod 2)) + 1
Next F
Next E
Next D
Next C
Next B
Next A
For i = 1 To 6
nDist(i * 3) = nDist(i * 3 - 1) + nDist(i * 3 - 2)
Next i
For n = LBound(nDist) To UBound(nDist)
ActiveCell.Offset(n - LBound(nDist), 1) = nDist(n)
Next n
With Application
.DisplayAlerts = True: .Calculation = xlCalculationAutomatic: .ScreenUpdating = True
End With
End Sub
Any help will be appreciated, thanks in advance.
Last edited: