macro-userform-case

R

Ricardo

Guest
bonjour j'ai un userform que j'ai fait et la il me reste juste a regler le fait que quand je veut passer d'une case a l'autre je doit le faire avec ma sourie est t'il possible de passer d'une case al'autre en appuyant sur enter et si oui comment l'intégrer dans ma macro...


merci



Option Explicit

Private Sub ComboBox1_Change() 'PIECE

End Sub

Private Sub ComboBox2_Change() 'EQUIPEMENT

End Sub

Private Sub ComboBox3_Change() 'QUANTITÉ

End Sub
Private Sub TextBox1_Change() 'DE

End Sub
Private Sub TextBox2_Change() 'A

End Sub
Private Sub Label1_Click()

End Sub

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

Private Sub COMPO_Initialize()
Me.Caption = X
Ini
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 = 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 = ""
TextBox1.Value = ""
TextBox2.Value = ""

ComboBox1.SetFocus 'PIECE
ComboBox2.SetFocus 'EQUIPEMENT
ComboBox3.SetFocus 'QUANTITÉ
TextBox1.SetFocus 'DE
TextBox2.SetFocus 'A
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("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 Combo() 'PIECE
With ComboBox1
.Value = ""
.SetFocus
End With
End Sub

Private Sub Combo2() 'EQUIPEMENT
With ComboBox2
.Value = ""
.SetFocus
End With
End Sub

Private Sub Combo3() 'QUANTITÉ
With ComboBox3
.Value = ""
.SetFocus
End With
End Sub

Private Sub Text1() 'DE
With TextBox1
.Value = ""
.SetFocus
End With
End Sub

Private Sub Text2() 'A
With TextBox2
.Value = ""
.SetFocus
End With
End Sub

Private Sub OptionButton1_Click()

End Sub

Private Sub UserForm_Click()

End Sub
 
Y

Yeahou

Guest
Bonjour Ricardo, le forum


As tu spécifié l'ordre de tabulation ?
pour pouvoir le spécifier, il faut que l'userform soit sélectionné (et pas un objet interne)
ensuite tu fais affichage/ordre de tabulation
et tu pourras spécifier les successions que tu désires pour la tabulation de tes objets sans avoir besoin de setfocus.

Cordialement, A+
 

Discussions similaires

Statistiques des forums

Discussions
313 096
Messages
2 095 228
Membres
106 229
dernier inscrit
MAHAMMEDIKHAWLA