Hi Gillesd?
Hope you see this. I came across this macro of yours
Option Explicit
Public A As Integer, B As Integer, C As Integer, D As Integer, E As Integer, F As Integer
Sub List_Comb()
' Macro to list combinations in an Excel sheet
Dim N As Long, nMinA As Integer, nMaxF As Integer
Sheets("List_Comb").Select
Range("A1").Select
Application.ScreenUpdating = False
N = 1
Selection.ColumnWidth = 18
ActiveCell.Value = "Comb."
nMinA = 1
nMaxF = 49
' Start of loops for 6 variables
For A = nMinA To nMaxF - 5
For B = A + 1 To nMaxF - 4
For C = B + 1 To nMaxF - 3
For D = C + 1 To nMaxF - 2
For E = D + 1 To nMaxF - 1
For F = E + 1 To nMaxF
If N = 65001 Then
Selection.ColumnWidth = 18
N = 1
ActiveCell.Offset(-65000, 1).Select
Application.ScreenUpdating = True
Application.ScreenUpdating = False
ActiveCell.Value = "Comb."
End If
Next F
Next E
Next D
Next C
Next B
Next A
Application.ScreenUpdating = True
End Sub
I'm not big on macros or programming, I have a little knowledge, some from my past and some from invaluable insights thanks to your macros I have found on this forum but with the above when I ran it I got a subscript out of range error. Then while stepping through to see if I could figure out the problem I got the same with error 9. Not one to be deterred I read through the proggy and noticed the "Sheets("List_Comb").Select" (no idea what it is or does but kinda took a wild guess at my sheet needing to be named List_Comb) so I tried that and I thought that was it, but within seconds cell A1 had Comb. in it but it was obvious the macro had finished!
Having limited knowledge on the subject I am now totally lost as to how to get it to work. Any pointers or a working macro would be much appreciated.
Hope you see this. I came across this macro of yours
Option Explicit
Public A As Integer, B As Integer, C As Integer, D As Integer, E As Integer, F As Integer
Sub List_Comb()
' Macro to list combinations in an Excel sheet
Dim N As Long, nMinA As Integer, nMaxF As Integer
Sheets("List_Comb").Select
Range("A1").Select
Application.ScreenUpdating = False
N = 1
Selection.ColumnWidth = 18
ActiveCell.Value = "Comb."
nMinA = 1
nMaxF = 49
' Start of loops for 6 variables
For A = nMinA To nMaxF - 5
For B = A + 1 To nMaxF - 4
For C = B + 1 To nMaxF - 3
For D = C + 1 To nMaxF - 2
For E = D + 1 To nMaxF - 1
For F = E + 1 To nMaxF
If N = 65001 Then
Selection.ColumnWidth = 18
N = 1
ActiveCell.Offset(-65000, 1).Select
Application.ScreenUpdating = True
Application.ScreenUpdating = False
ActiveCell.Value = "Comb."
End If
Next F
Next E
Next D
Next C
Next B
Next A
Application.ScreenUpdating = True
End Sub
I'm not big on macros or programming, I have a little knowledge, some from my past and some from invaluable insights thanks to your macros I have found on this forum but with the above when I ran it I got a subscript out of range error. Then while stepping through to see if I could figure out the problem I got the same with error 9. Not one to be deterred I read through the proggy and noticed the "Sheets("List_Comb").Select" (no idea what it is or does but kinda took a wild guess at my sheet needing to be named List_Comb) so I tried that and I thought that was it, but within seconds cell A1 had Comb. in it but it was obvious the macro had finished!
Having limited knowledge on the subject I am now totally lost as to how to get it to work. Any pointers or a working macro would be much appreciated.