![]() |
Compile error
Hi Folks,
I found this code doing a Google search and thought I'd give it a try. Unfortunately, I get a compile error but I am not much good when it comes to VBA. Dim combo As String numbers = Array(1, 2, 3, 4) 'enter numbers played here For i = 0 To 3 For j = 0 To 3 For k = 0 To 3 For l = 0 To 3 If Not ((j = i) Or (k = j Or k = i) Or (L = k Or L = j Or L = i)) Then combo = numbers(i) & numbers(j) & numbers(k) & numbers(l) ActiveCell = combo ActiveCell.Offset(1, 0).Select End If Next l Next k Next j Next i End Sub The error flags If Not ... Then Any ideas? Thanks! Biff |
Compile error
Works fine for me; did you fix the word wrap?
Alan Beban Biff wrote: Hi Folks, I found this code doing a Google search and thought I'd give it a try. Unfortunately, I get a compile error but I am not much good when it comes to VBA. Dim combo As String numbers = Array(1, 2, 3, 4) 'enter numbers played here For i = 0 To 3 For j = 0 To 3 For k = 0 To 3 For l = 0 To 3 If Not ((j = i) Or (k = j Or k = i) Or (L = k Or L = j Or L = i)) Then combo = numbers(i) & numbers(j) & numbers(k) & numbers(l) ActiveCell = combo ActiveCell.Offset(1, 0).Select End If Next l Next k Next j Next i End Sub The error flags If Not ... Then Any ideas? Thanks! Biff |
Compile error
See, I told you I wasn't much(any!) good at VBA.
Those little hints really go a long way! Thanks Alan. Biff -----Original Message----- Works fine for me; did you fix the word wrap? Alan Beban Biff wrote: Hi Folks, I found this code doing a Google search and thought I'd give it a try. Unfortunately, I get a compile error but I am not much good when it comes to VBA. Dim combo As String numbers = Array(1, 2, 3, 4) 'enter numbers played here For i = 0 To 3 For j = 0 To 3 For k = 0 To 3 For l = 0 To 3 If Not ((j = i) Or (k = j Or k = i) Or (L = k Or L = j Or L = i)) Then combo = numbers(i) & numbers(j) & numbers(k) & numbers (l) ActiveCell = combo ActiveCell.Offset(1, 0).Select End If Next l Next k Next j Next i End Sub The error flags If Not ... Then Any ideas? Thanks! Biff . |
All times are GMT +1. The time now is 12:07 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com