boucle

R

Ricardo

Guest
Bonjour j'ai un programme et dans mon pop menu quand je fait enter l'information rentre dans une base de donné et j'aimerais que le curseur revient au début quand tout les case sont rempli, j,imagine que ca doit prendre une boucle mais j'en ai jamais fait alor!!! et dans mon programme la case combobox4 le curseur ne veut pas y aller cher pas pourquoi ???


Merci..



Option Explicit
Private Sub ComboBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = vbKeyReturn Then KeyCode = vbKeyTab
End Sub
Private Sub ComboBox4_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = vbKeyReturn Then KeyCode = vbKeyTab
End Sub
Private Sub ComboBox2_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = vbKeyReturn Then KeyCode = vbKeyTab
End Sub
Private Sub ComboBox3_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = vbKeyReturn Then KeyCode = vbKeyTab
End Sub
Private Sub textbox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = vbKeyReturn Then KeyCode = vbKeyTab
End Sub

'Macro pour entrée de donnée Yves Vaillant , prix de revient

Private Sub COMPO_Initialize()
Me.Caption = X
ComboBox1.SetFocus 'Donne le focus à Cbo1 à l'initialisation

End Sub

Private Sub CommandButton1_Click()
Dim X As Integer
Dim i As Integer
Dim Nom As String
Dim Msg As Byte

Nom = ComboBox1.Value 'PIECE
If Nom = "" Then Exit Sub
Msg = MsgBox(Nom, vbYesNo)
If Msg = 6 Then
X = Sheets("ENTRÉE").Range("A65536").End(xlUp).Row + 1
Sheets("ENTRÉE").Range("A" & X).Value = Nom
For i = Range("A65536").End(xlUp).Row - 1 To 2 Step 1
Next

Nom = ComboBox4.Value ' INDIRECT
X = Sheets("ENTRÉE").Range("C65536").End(xlUp).Row + 1
Sheets("ENTRÉE").Range("C" & X).Value = Nom

Nom = ComboBox2.Value ' EQUIPEMENT
X = Sheets("ENTRÉE").Range("b65536").End(xlUp).Row + 1
Sheets("ENTRÉE").Range("b" & X).Value = Nom

Nom = ComboBox3.Value ' QUATITÉ
X = Sheets("ENTRÉE").Range("F65536").End(xlUp).Row + 1
Sheets("ENTRÉE").Range("F" & X).Value = Nom

Nom = TextBox1.Value ' DE
X = Sheets("ENTRÉE").Range("D65536").End(xlUp).Row + 1
Sheets("ENTRÉE").Range("D" & X).Value = Nom

Nom = TextBox2.Value ' DE
X = Sheets("ENTRÉE").Range("E65536").End(xlUp).Row + 1
Sheets("ENTRÉE").Range("E" & X).Value = Nom
End If

ComboBox1.Value = "" ' POUR VIDÉ LA CASE DU POP
ComboBox2.Value = ""
ComboBox3.Value = ""
ComboBox4.Value = ""
TextBox1.Value = ""
TextBox2.Value = ""

End Sub

Private Sub CommandButton2_Click()

End Sub
Dim Plage As Range
Dim Cell As Range
Dim Msg As Integer
Dim Nom As String
L = Sheets("ENTRÉE").Range("A65536").End(xlUp).Row 'PIECE
Set Plage = Sheets("ENTRÉE").Range("A2:A" & L)
Nom = ComboBox1.Value
L = Sheets("ENTRÉE").Range("C65536").End(xlUp).Row 'INDIRECT
Set Plage = Sheets("ENTRÉE").Range("C2:C" & L)
Nom = ComboBox4.Value
L = Sheets("ENTRÉE").Range("B65536").End(xlUp).Row 'EQUIPEMENT
Set Plage = Sheets("ENTRÉE").Range("B2:B" & L)
Nom = ComboBox2.Value
L = Sheets("ENTRÉE").Range("F65536").End(xlUp).Row 'QUANTITÉ
Set Plage = Sheets("ENTRÉE").Range("F2:F" & L)
Nom = ComboBox3.Value
L = Sheets("ENTRÉE").Range("D65536").End(xlUp).Row 'DE
Set Plage = Sheets("ENTRÉE").Range("D2:D" & L)
Nom = TextBox1.Value
L = Sheets("ENTRÉE").Range("E65536").End(xlUp).Row 'A
Set Plage = Sheets("ENTRÉE").Range("E2:E" & L)
Nom = TextBox2.Value
If Nom = "" Then Exit Sub

Private Sub CommandButton3_Click()
Unload Me
End Sub



Private Sub UserForm_Click()

End Sub
 

Statistiques des forums

Discussions
313 096
Messages
2 095 228
Membres
106 231
dernier inscrit
maud011