Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() Hello I have a sheet with a series of numbers with which I want to make combinations. Approximately 100 lines Sheet named Base Between each series, the blank rows are planned for the combinations of the numbers of the various lines. Ex : combin(8;6) 28 Blank rows Row 1 28 Blank rows Row 2 28 Blank rows Row 3 28 Blank rows ETC.. the combinations must be offset(0,5) of the derniere nonempty cell of columns A: to O: of each line I would like if possible a loop on the sheet bases with macro Ci below. It only functions with the first line. Thank you Option Explicit Option Base 1 Sub Combin_6Num() Dim A As Integer, B As Integer, C As Integer Dim D As Integer, E As Integer, F As Integer Dim I As Long, J As Integer, vN(10) As Integer Application.ScreenUpdating = False For J = 1 To 10 vN(J) = Cells(J).Value Next J = J - 1 Cells(1, 37).Select I = 1 For A = 1 To J - 5 For B = A + 1 To J - 4 For C = B + 1 To J - 3 For D = C + 1 To J - 2 For E = D + 1 To J - 1 For F = E + 1 To J ActiveCell.Offset(0, 0).Value = I ActiveCell.Offset(0, 1).Value = vN(A) ActiveCell.Offset(0, 2).Value = vN(B) ActiveCell.Offset(0, 3).Value = vN(C) ActiveCell.Offset(0, 4).Value = vN(D) ActiveCell.Offset(0, 5).Value = vN(E) ActiveCell.Offset(0, 6).Value = vN(F) I = I + 1 ActiveCell.Offset(1, 0).Select Select Case I Case 60001, 120001, 180001, 240001, 300001, 360001, 420001, 480001, 540001 ActiveCell.Offset(-60000, 8).Select End Select Next F Next E Next D Next C Next B Next A Range("A1").Select End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
loop a macro | Excel Discussion (Misc queries) | |||
how to put a loop in a macro? | New Users to Excel | |||
macro loop | Excel Discussion (Misc queries) | |||
how can i loop a macro | Excel Discussion (Misc queries) | |||
macro loop | Excel Discussion (Misc queries) |