# Wanting a wheel

#### larbec

##### Member
Does anyone gave any wheels in excel they are willing to share? If not I'll get to programming.

Thanks

#### Icewynd

##### Member
I have a few for 6/49 and some P3 wheels. What exactly are you looking for?

Good Luck!

#### larbec

##### Member
I was looking for a positional wheel, something to use with the jackpot games so the 6/49 can be converted I'm sure

I'm new to wheels so your suggestion is much appreciated too (-:

#### Icewynd

##### Member
Don't have any positional wheels, but oddly enough, I was thinking about that the other day. They could be nicely programmed into excel with a spinner for the numbers to be considered in each position.

Maybe someone knows of a good positional wheel?

Good Luck!

#### larbec

##### Member
Here you go Ice. I said If not I'll program one lol, what kind if wheel do you use?

Just put this in excel

Option Explicit

Sub Main()
Dim Result As New Collection
Dim Data, This
Dim i As Long, j As Long

'Get the values from this region:
Data = Range("A3").CurrentRegion.Value
ReDim This(1 To UBound(Data, 2))
'Start the recursion to build the combinations into a collection
Process Result, Data, This, 1, WorksheetFunction.Min(Data) - 1

'Copy the combinations into a 2D array
ReDim Data(1 To Result.Count, 1 To UBound(Data, 2))
For Each This In Result
i = i + 1
For j = 1 To UBound(This)
Data(i, j) = This(j)
Next
Next
'Write into the sheet
Range("H3").Resize(UBound(Data), UBound(Data, 2)) = Data
End Sub

Private Sub Process(ByRef Result As Collection, ByRef Data, ByRef This, ByVal Index As Long, ByVal Min)
Dim i As Long
'For each row
For i = 1 To UBound(Data)
'Skip lower numbers
If Data(i, Index) > Min Then
'Get value into this slot
This(Index) = Data(i, Index)
'At the right end?
If Index < UBound(Data, 2) Then
'No, start another recursion one column to the right
Process Result, Data, This, Index + 1, This(Index)
Else
End If
End If
Next
End Sub

#### Frank

##### Member
OK Larbec I give up. I'll break the ice (no pun intended) and ask.
What is this program supposed to do?
Where does it expect to find data?
All I get is subscript out of range when I place a row of numbers (or an array) intersecting with cell A3.
If I place a column of numbers intersecting A3, it just copies and pastes it to H3.
I think a more precise description of what its doing and details of the data set placement would be appreciated.

Thanks

#### larbec

##### Member
Sorry for late LATE reply. Put your macro in the module. Then starting in A3 put your 1st number B3 2nd number and so on then RuN the macro. It will wheel them and put results in H3

#### bloubul

##### Member
larbec

The macro runs out of memory here "Result.Add This"
It's at the end of your macro

BlouBul

#### Frank

##### Member
Well Bloubul, it works after a fashion, but its very 'finniky'. You have to observe strict rules.

1. The maximum number of balls on one row, say A3:G3 is 7. The results overwrite them otherwise.
2. you can have additional rows of numbers below row 3, cols A to G and it will use them,
However:-
3. it doesn't like unsorted (left to right) numbers, you either get an error message or it ignores some numbers.

When writing the wheel it favours the lowest numbers (leftmost) in your list(s).

It helps if you amend part of the code, to separate the results from the data.

In the Sub Main after the line:-
Dim i As Long, j As Long

Range("I3:O30000").ClearContents

Also at the end of that sub, change:-
Range("H3").Resize(UBound(Data), UBound(Data, 2)) = Data

to :-
Range("I3").Resize(UBound(Data), UBound(Data, 2)) = Data

You might have a bit more success.

Good luck!