Looking for sss

Hi,sss

Thank you so much for the VBA module. It works perfectly and fast, except the arrangement of the output position which I prefer to have them from big to small like the one in brackets.

This will give a clear & easy view.

Final Digit Tenths
2,4,14,33,36,40 ===== 1-1-1-2-1 (2-1-1-1-1) === 2-1-2-1 (2-2-1-1)

7,12,14,35,36,41===== 1-1-1-1-1-1 === 1-2-2-1 (2-2-1-1)

22,25,29,31,32,38 === 1-2-1-1-1 (2-1-1-1-1) === 3-3

4,8,10,11,28,36 ===== 1-1-1-1-2 (2-1-1-1-1) === 2-2-1-1

13,17,19,27,32,37 === 1-1-3-1 (3-1-1-1) === 3-1-2 (3-2-1)


Can you modify the code so that it sort them before writing to the columns.

Regards,
Michael
 

sss

Member
michael168 said:
except the arrangement of the output position which I prefer to have them from big to small like the one in brackets.

This will give a clear & easy view.

Regards,
Michael

Hi Michael,

put a line
====
Sort A
====

in both gettendigits and getfinaldigits right before the line

===
s=""
===

and add such procedure:

===
Private Sub Sort(A As Variant)
Dim B()
Dim i&, j&, itemNo&, ArrLen&
ArrLen = UBound(A)
ReDim B(0 To ArrLen) 'this is a result array B

itemNo = -1 'initialising item number

For j = 6 To 0 Step -1 ' 6 (6 numbers) is a max possible value for the array entry
For i = 0 To ArrLen
If A(i) = j Then
itemNo = itemNo + 1
B(itemNo) = A(i)
A(i) = -1
End If
Next
Next

'return sorted:
For i = 0 To ArrLen: A(i) = B(i): Next

End Sub

===

sss
 

Sidebar

Top