Combination to GillesD or another goog vba

Hoareau

Member
Hello

that is to say
columns ABCDEFGHIJ >> FEUIL1 >> 3 A 10 DIGITS is
columns ABCDEFGHIJKL >> FEUIL2 >>>>4 A 12 CHIIFRES

The GOAL IS TO MAKE The COMBINAISZONS WITH The numbers OF ABCDEFGHIJKL FEUIL2, FOR EACH LINE, APPROXIMATELY 100

My incomplet maco below

put numbers in abcd Feuil1 and abcde feuil2, select feuil1 a1 >> run macro

Sheets("feuil2").Cells(1, 14) = Combs
Just to show or begin the combinations and will be removed


Is this possible TO:

To make a loop which posts for each line of N of feuil2 the combinations of Sum_1 X Sum_2
with macro that you put on the forum

The numbers TO BE TAKEN INTO ACCOUNT FOR
The COMBINATIONS ARE IN The COLUMNS: ABCDEFGHIJKL > > FEUIL2


- For the "select case" 3 and 4, to put the macro one which makes
the corresponding combinations compared to Sum_1 and Sum_2,
The COMBINATIONS START TO LEAVE The COLUMN O FEUIL2
I WILL MAKE the CONTINUATION WITH the MODELES

hope to be included/understood

Sub test_3()
Application.ScreenUpdating = False

Dim Sum_1 As Integer
Dim Sum_2 As Integer
Dim myarray(1)
Dim numRows As Integer
Dim r As Long

Application.ScreenUpdating = False
Sum_1 = Sheets("feuil1").[a2].End(xlToRight).Column


Sum_2 = Sheets("feuil2").[a2].End(xlToRight).Column

'Attention! il faut que B2 ne soit pas vide pour la procédure ci dessus

myarray(1) = Application.WorksheetFunction.combin(Sum_2, Sum_1)

'>>>>
Sheets("feuil2").Activate
r = Cells(Rows.Count, "A").End(xlUp).Row
numRows = myarray(1)
For r = r To 1 Step -1
ActiveSheet.Rows(r + 1).Resize(numRows).Insert
Next r


'>>>>
Combs = Combination & " " & Sum_2 & " " & "X" & " " & Sum_1

MsgBox Combs

Select Case Sum_1

Case 3
'Call Combin_Sum_2_X3
Sheets("feuil2").Cells(1, 14) = Combs
Case 4
'Call Combin_Sum_2_X4
Sheets("feuil2").Cells(1, 14) = Combs
Case 5
'Call Combin_Sum_2_X5
Sheets("feuil2").Cells(1, 14) = Combs
Case 6
'Call Combin_Sum_2_X6
Sheets("feuil1").Cells(1, 14) = Combs

End Select
Application.ScreenUpdating = True
End Sub

Thank You
 

Sidebar

Top