Vous utilisez un navigateur obsolète. Il se peut que ce site ou d'autres sites Web ne s'affichent pas correctement. Vous devez le mettre à jour ou utiliser un navigateur alternatif.
Ton USF ne s'ouvre pas, car il y a des erreurs dans tes macros!
Ta macro avant modification :
Code:
Dim Derlign As Long, Num As Long
Private Sub CommandButton1_Click()
[COLOR="Red"][U][B].[/B][/U][/COLOR]Range("A" & Derlign) = CLng(TextBox1)
[COLOR="Red"][U][B].[/B][/U][/COLOR]Range("B" & Derlign) = CDate(TextBox2)
[COLOR="Red"][U][B].[/B][/U][/COLOR]Range("C" & Derlign) = ComboBox1
[COLOR="Red"][U][B].[/B][/U][/COLOR]Range("D" & Derlign) = ComboBox2
[COLOR="Red"][U][B].[/B][/U][/COLOR]Range("E" & Derlign) = ComboBox3
[COLOR="Red"][U][B].[/B][/U][/COLOR]Range("F" & Derlign) = ComboBox4
[COLOR="Red"][U][B].[/B][/U][/COLOR]Range("G" & Derlign) = TextBox3
[COLOR="Red"][U][B].[/B][/U][/COLOR]Range("H" & Derlign) = TextBox4
[COLOR="Red"][U][B].[/B][/U][/COLOR]Range("I" & Derlign) = TextBox5
[COLOR="Red"][U][B].[/B][/U][/COLOR]Range("J" & Derlign) = TextBox6
[COLOR="Red"][U][B].[/B][/U][/COLOR]Range("K" & Derlign) = ComboBox5
[COLOR="Red"][U][B].[/B][/U][/COLOR]Range("L" & Derlign) = ComboBox6
[COLOR="Red"][U][B].[/B][/U][/COLOR]Range("M" & Derlign) = ComboBox7
[COLOR="Red"][U][B].[/B][/U][/COLOR]Range("N" & Derlign) = ComboBox8
[COLOR="Red"][U][B].[/B][/U][/COLOR]Range("O" & Derlign) = ComboBox9
[COLOR="Red"][U][B].[/B][/U][/COLOR]Range("P" & Derlign) = ComboBox10
[COLOR="Red"][U][B].[/B][/U][/COLOR]Range("Q" & Derlign) = TextBox7
[COLOR="Red"][U][B].[/B][/U][/COLOR]Range("R" & Derlign) = TextBox8
End Sub
Private Sub UserForm_Initialize()
With Sheets("Suivi")
Derlign = .Range("A65000").End(xlUp).Row + 1
Num = Application.Max(.Range("A3:A" & Derlign)) + 1
TextBox1 = Num
[COLOR="DarkSlateBlue"][B]Suivi.[/B][/COLOR]TextBox2.Value = Format(Now, "dd/mm/yyyY")
End With
With Sheets("Liste")
ComboBox1[COLOR="DimGray"][B].List[/B][/COLOR] = .Range([COLOR="DarkOrange"][I]"Résident"[/I][/COLOR]).Value
ComboBox2[COLOR="DimGray"][B].List[/B][/COLOR] = .Range([COLOR="DarkOrange"][I]"Type"[/I][/COLOR]).Value
ComboBox3[COLOR="DimGray"][B].List[/B][/COLOR] = .Range([I]"Cotations"[/I]).Value
ComboBox4[COLOR="DimGray"][B].List[/B][/COLOR] = .Range([COLOR="DarkOrange"][I]"VHS"[/I][/COLOR]).Value
ComboBox5[COLOR="DimGray"][B].List[/B][/COLOR] = .Range([COLOR="DarkOrange"][I]"EQUIPE"[/I][/COLOR]).Value
ComboBox6[COLOR="DimGray"][B].List[/B][/COLOR] = .Range("UAP").Value
ComboBox7[COLOR="DimGray"][B].List[/B][/COLOR] = .Range([COLOR="DarkOrange"][I]"LIGNE"[/I][/COLOR]).Value
ComboBox8[COLOR="DimGray"][B].List[/B][/COLOR] = .Range([COLOR="DarkOrange"][I]"COMPOSANT"[/I][/COLOR]).Value
ComboBox9[COLOR="DimGray"][B].List[/B][/COLOR] = .Range([COLOR="DarkOrange"][I]"DEFAUTS"[/I][/COLOR]).Value
ComboBox10[COLOR="DimGray"][B].List[/B][/COLOR] = .Range([COLOR="DarkOrange"][I]"I"[/I][/COLOR]).Value
End With
TextBox1.Enabled = False
End Sub
Si on met un point devant Range : . tu dois avoir avant With Sheets("...") et après End With, ce qui n'est pas le cas ici!!!
.List pourquoi?
"Résident" ? Entre les guillemets, il faut normalement mettre les coordonnées de la cellule!! Par exemple : Range("A1")
Si "Résident" est le nom que tu as donnée à une cellule (ou groupe de cellule) : "insertion" / "nom" / "définir", chose que tu n'as pas faite il aurait fallait l'écrire entre crochet! Ainsi : [Résident] et non pas comme tu l'as fait : Range("Résident").Value
Suivi.? pourquoi? Ta TextBox est dans une USF, pourquoi mettre le nom d'un de tes onglets? Il ne faut rien mettre! Ou à la rigueur : Me.TextBox2
Ta macro après modification :
Code:
Dim Derlign As Long, Num As Long
Private Sub CommandButton1_Click()
Range("A" & Derlign) = CLng(TextBox1)
Range("B" & Derlign) = CDate(TextBox2)
Range("C" & Derlign) = ComboBox1
Range("D" & Derlign) = ComboBox2
Range("E" & Derlign) = ComboBox3
Range("F" & Derlign) = ComboBox4
Range("G" & Derlign) = TextBox3
Range("H" & Derlign) = TextBox4
Range("I" & Derlign) = TextBox5
Range("J" & Derlign) = TextBox6
Range("K" & Derlign) = ComboBox5
Range("L" & Derlign) = ComboBox6
Range("M" & Derlign) = ComboBox7
Range("N" & Derlign) = ComboBox8
Range("O" & Derlign) = ComboBox9
Range("P" & Derlign) = ComboBox10
Range("Q" & Derlign) = TextBox7
Range("R" & Derlign) = TextBox8
End Sub
Private Sub Label17_Click()
End Sub
Private Sub UserForm_Initialize()
With Sheets("Suivi")
Derlign = .Range("A65000").End(xlUp).Row + 1
Num = Application.Max(.Range("A3:A" & Derlign)) + 1
TextBox1 = Num
TextBox2.Value = Format(Now, "dd/mm/yyyY")
End With
With Sheets("Liste")
ComboBox1 = [Résident]
ComboBox2 = [Type]
ComboBox3 = [Cotations]
ComboBox4 = [VHS]
ComboBox5 = [EQUIPE]
ComboBox6 = [UAP]
ComboBox7 = [LIGNE]
ComboBox8 = [COMPOSANT]
ComboBox9 = [DEFAUTS]
ComboBox10 = [I].Value
End With
TextBox1.Enabled = False
End Sub
Evidement, avant de lancer cette macro modifié, il te faut nommer tes cellules : RESIDENT, ..., EQUIPE, UAP, ..., DEFAUTS, I
En attendant, pour tester, si tu remplacer tout ces noms (crochets inclus) par Range("A1"), tu verras que ton code fonctionne et ton USF s'ouvre.
Ce site utilise des cookies pour personnaliser le contenu, adapter votre expérience et vous garder connecté si vous vous enregistrez.
En continuant à utiliser ce site, vous consentez à notre utilisation de cookies.