Ajout ComoboBox en cascade dans userform et macro existante
Bonjour a tous,
de retour après plusieurs (et pour cause de changement de travail) pour adapter mon tableau excel a cette nouvelle activité.
Le but de ce tableau est de rentrer les temps passés sur différents projets (pour affiner ensuite la partie chiffrage).
La plus grande partie de la macro fonctionne tres bien ( elle remplis le premier onglet "donnees" avec certaines infos, et remplis aussi les onglets nominatifs suivants)
je souhaite ajouter a mon userform une liste en cascade de 2 niveaux (client et bateau).
La première liste se déroule bien,mais plante quand je sélectionne un chiffre, et je coince aussi sur la 2eme, j'ai épluche moultes pages du forum, de diverses pages web et le site de Jacques Ggontier, en vain, je n'arrive pas afficher cette deuxième liste dépendante de la première.
Ci dessous, le code, pas le fichier excel (il fait quasi 10 Mo 8O ,alors qu'il n'y a pas grand chose dedans :?).
D'avance merci pour vos judicieux conseils :)
Laurent
Code:
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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
|
Private Sub ComboBox1_Change() 'Combobox bateau
If ComboBox1.Value = "" Then Exit Sub
ComboBox2.Clear
Dim NomRange As String
If NomDefini(NomRange) Then
ComboBox2.List = Application.Transpose(Range(NomRange))
End If
End Sub
Private Sub ComboBox4_Change() 'combobox sous produit
Dim plage As Range
Set plage = Sheets("LISTE").Range("G2:F20")
End Sub
Private Sub ComboBox5_Change() 'Combobox activité
Dim plage As Range
Set plage = Sheets("LISTE").Range("A2:A50")
End Sub
Private Sub ComboBox2_Change() 'Combobox bateau
End Sub
Private Sub ComboBox3_Change() 'Combobox produit
Dim plage As Range
Set plage = Sheets("LISTE").Range("F2:F99")
End Sub
Private Sub ComboBox6_Change() 'Combobox intervenant
Dim plage As Range
Set plage = Sheets("LISTE").Range("E2:E15")
End Sub
Private Sub ComboBox7_Change() 'Combobox bateaux
If ComboBox7.Value = "" Then Exit Sub
Dim NomRange As String
NomRange = CaracSpec(ComboBox7.Value)
End Sub
Private Sub CommandButton1_Click()
Unload UserForm1
End Sub
Private Sub CommandButton2_Click()
'Recuperation de la derniere ligne et inscription des données
Dim intLine As Integer
intLine = Range("a65000").End(xlUp).Row + 1
Cells(intLine, 1).Value = DTPicker1.Value
Cells(intLine, 2).Value = ComboBox2.Value
Cells(intLine, 3).Value = ComboBox3.Value
Cells(intLine, 4).Value = ComboBox4.Value
Cells(intLine, 5).Value = ComboBox6.Value
Cells(intLine, 6).Value = TextBox1.Value
intLine = Sheets("DONNEES " & ComboBox6.Value).Range("a65000").End(xlUp).Row + 1
With Sheets("DONNEES " & ComboBox6.Value)
.Cells(intLine, 1).Value = DTPicker1.Value
.Cells(intLine, 2).Value = ComboBox2.Value
.Cells(intLine, 3).Value = ComboBox3.Value
.Cells(intLine, 4).Value = ComboBox4.Value
.Cells(intLine, 5).Value = ComboBox6.Value
.Cells(intLine, 6).Value = TextBox1.Value
End With
End Sub
'affichage calendrier
Private Sub DTPicker1_CallbackKeyDown(ByVal KeyCode As Integer, ByVal Shift As Integer, ByVal CallbackField As String, CallbackDate As Date)
End Sub
Private Sub ListBox1_Click()
End Sub
Private Sub Label7_Click()
End Sub
Private Sub UserForm_Initialize()
'spécifie la date du jour lors de l'affichage de l'USF
DTPicker1.Value = Now
ComboBox1.Clear
ComboBox1.List = Application.Transpose(Range("client"))
ComboBox2.Clear
End Sub
Private Sub DTPicker1_Change()
MsgBox DTPicker1.Value
End Sub
Private Sub Label1_Click()
End Sub
Private Sub Label5_Click()
End Sub
Private Sub TextBox1_Change()
End Sub
Private Sub TextBox2_Change()
End Sub
Private Sub UserForm_Click()
End Sub |