1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
If IsNumeric(TextBox_nb_ruban.Value) Then
nb_ruban = TextBox_nb_ruban.Value
If nb_ruban < 16 Then
Dim TextBox_ruban_(1 To 15)
Dim Label_ruban_(1 To 15)
Dim derniere_ligne As Integer
Workbooks.Open Filename:= _
lien_tableau_base, ReadOnly:=True
derniere_ligne = Workbooks("UPR - Tableau base.xlsx").Sheets("Base").Range("C1").End(xlDown).Row
k = 0
For i = 1 To nb_ruban
k = k + 1
Controls("TextBox_ruban_" & i).Visible = True
Controls("TextBox_ruban_" & i).Top = debut
Controls("TextBox_ruban_" & i).Left = 78
Controls("TextBox_ruban_" & i).Width = 114
Controls("TextBox_ruban_" & i).Height = 18
Controls("TextBox_ruban_" & i).Font.Size = 8
For j = 1 To derniere_ligne - 1
If Workbooks("UPR - Tableau base.xlsx").Sheets("Base").Range("A" & j + 1) = programme Then
If Workbooks("UPR - Tableau base.xlsx").Sheets("Base").Range("C" & j + 1) = reference Then
If Workbooks("UPR - Tableau base.xlsx").Sheets("Base").Range("D" & j + 1) = Indice Then
If Workbooks("UPR - Tableau base.xlsx").Sheets("Base").Range("I" & j + 1) = machine Then
MsgBox Split(Workbooks("UPR - Tableau base.xlsx").Sheets("Base").Range("M" & j + 1).Value)
Controls("TextBox_ruban_" & k).Value = Split(Workbooks("UPR - Tableau base.xlsx").Sheets("Base").Range("M" & j + 1).Validation.Formula1, ";")(k - 1) 'voila le code qui pose probleme
End If
End If
End If
End If
Next
Controls("Label_ruban_" & i).Visible = True
Controls("Label_ruban_" & i).Top = Start
Controls("Label_ruban_" & i).Left = 6
Controls("Label_ruban_" & i).Width = 70
Controls("Label_ruban_" & i).Height = 12
Controls("Label_ruban_" & i).Caption = "Ruban n°" & i
UserForm2_inserer_ruban.Height = UserForm2_inserer_ruban.Height + 18
CommandButton_retour.Top = CommandButton_retour.Top + 18
CommandButton_ajouter.Top = CommandButton_ajouter.Top + 18
debut = debut + 18
Start = Start + 18
Next
Workbooks("UPR - Tableau base.xlsx").Close SaveChanges:=False
Else
MsgBox "Maximum 15 ruban"
End If
Else
MsgBox "entré un nombre ! "
End If
End Sub |
Partager