Macro not working?

sezuh

Well-known Member
Joined
Nov 19, 2010
Messages
708
Hi,
would you kindly tell me why this code is not working please????
After i paste and press ALT+F8 its blank,if you can point me to hte right direction ,would much... appreciated.here is the code taken from here;
http://www.xtremevbtalk.com/showthread.php?t=168296
Code:
Option Explicit ' ' Odometer-style Combination generating functions '    by MathImagics  (Dr Memory) 2004 ' ' SetCombination ' NextCombination ' ThisCombination ' Dim Cwheel() As Long  Public Sub SetCombination(ByVal N As Long, ByVal K As Long, ByVal Combn As String)     ReDim token(K) As String    token = Split(Combn, ",")        If UBound(token) <> K - 1 Then Exit Sub        Dim W As Long     ReDim Cwheel(0 To K)        For W = 1 To K       Cwheel(W) = Val(token(W - 1))       If Cwheel(W) <= Cwheel(W - 1) Then Exit Sub  ' invalid combn       If Cwheel(W) > N Then Exit Sub               ' ditto       Next    End Sub     Public Function ThisCombination() As String    '    ' Current Combination readout    '    Dim i As Long, Comb As String    Comb = Cwheel(1)    For i = 2 To UBound(Cwheel)       Comb = Comb & ", " & Cwheel(i)       Next    ThisCombination = Comb    End Function     Public Sub NextCombination(ByVal N As Long, ByVal K As Long)    '  "Combination Odometer"    '    '  By MathImagics:  the array Cwheel contains the current    '                   K items combined, in increasing order.    '                   Each call to this sub will adjust Cwheel    '                   so it contains    '                   the NEXT combination in lex order    '        Dim i As Long    Dim j As Long    i = K    While Cwheel(i) >= N - K + i       i = i - 1   ' find rightmost wheel that allows an increment       If i = 0 Then          ' wraps around (natch!)          i = 1          Cwheel(1) = 0          End If       Wend    Cwheel(i) = Cwheel(i) + 1    For j = i + 1 To K       Cwheel(j) = Cwheel(i) + j - i       Next    End Sub

</pre> thanks
sezuh
 
Last edited:

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.

Forum statistics

Threads
1,224,564
Messages
6,179,547
Members
452,925
Latest member
duyvmex

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top