Re : optionbutton et textbox
g un petit souci voici mon code:
Private Sub enregistrer_Click()
If ComboBox1.Value = "" Then
MsgBox ("Il faut donner un nom de demandeur.")
Exit Sub
End If
If TextBox1.Value = "" Then
MsgBox ("Il faut donner un numéro de poste.")
Exit Sub
End If
If ComboBox3.Value = "" Then
MsgBox ("Il faut donner le type de véhicule.")
Exit Sub
End If
If ref.Value = "" Then
MsgBox ("Il faut donner la référence du produit.")
Exit Sub
End If
If ind.Value = "" Then
MsgBox ("Il faut donner l'indice correspondant au plan concerné.")
Exit Sub
End If
If qte.Value = "" Then
MsgBox ("Il faut donner la quantité de pièces à contrôler.")
Exit Sub
End If
If desc.Value = "" Then
MsgBox ("Il faut donner le contexte de la métrologie.")
Exit Sub
End If
If infos.Value = "" Then
MsgBox ("Il faut donner le descriptif des cotes à contrôler.")
Exit Sub
End If
If dest.Value = "" Then
MsgBox ("Il faut un destinataire pour le rapport de contrôle.")
Exit Sub
End If
If liste.Value = "" Then
MsgBox ("Précisez la destination des pièces après la métrologie.")
Exit Sub
End If
If scalp.Value = "" Then
MsgBox ("Vous devez donner une traçabilité de ou des composant(s).")
Exit Sub
End If
Sheets("base").Cells(numero + 1, 1) = de
Sheets("Base").Cells(numero + 1, 2) = TxtDate
Sheets("base").Cells(numero + 1, 3) = ComboBox1
Sheets("base").Cells(numero + 1, 4) = TextBox1
Sheets("base").Cells(numero + 1, 5) = TextBox2
Sheets("base").Cells(numero + 1, 6) = ComboBox3
Sheets("base").Cells(numero + 1, 7) = ComboBox4
Sheets("base").Cells(numero + 1, 8) = ref
Sheets("base").Cells(numero + 1, 9) = ind
Sheets("base").Cells(numero + 1, 10) = qte
Sheets("base").Cells(numero + 1, 11) = scalp
Dim i As Byte
If TextBox3 <> "" Then Sheets("base").Cells(numero + 1, 12) = TextBox3: Exit Sub
For i = 1 To 3
If Controls("Opt" & i) = True Then
Sheets("base").Cells(numero + 1, 12) = Controls("Opt" & i).Caption
End If
Next i
Sheets("base").Cells(numero + 1, 13) = infos
Sheets("base").Cells(numero + 1, 14) = desc
Sheets("Base").Cells(numero + 1, 15) = ComboBox2
Sheets("Base").Cells(numero + 1, 16) = liste
Sheets("Base").Cells(numero + 1, 17) = dest
With Sheets("imp")
.Range("f3") = de
.Range("d3") = TxtDate
.Range("b3") = ComboBox1
.Range("b4") = TextBox1
.Range("b5") = TextBox2
.Range("e5") = scalp
.Range("b7") = ref
.Range("e7") = ind
.Range("g7") = qte
.Range("a9") = desc
.Range("a19") = infos
.Range("b51") = dest
.Range("b53") = liste
.Range("b54") = ComboBox2
For i = 1 To 3
If Controls("Opt" & i).Value = True Then
.Range("d4") = Controls("Opt" & i).Caption
End If
Next i
.Range("e6") = ComboBox3
.Range("g6") = ComboBox4
End With
Sheets("imp").Visible = True
Sheets("imp").Select
form.Hide
Intro.Hide
Call CreateMailWithCopy(Sheets("imp").Range("Subject"), _
Sheets("imp").Range("Destinataires").CurrentRegion, _
Sheets("imp").Range("Corps"), _
Sheets("imp").Range("Copie").CurrentRegion)
enreg.Show
k = 2
encore:
If Sheets("base").Cells(k, 1) = "" Then
numde = "M" & Format(Now(), "yymm") & Format(k - 1, "000")
Else
k = k + 1
GoTo encore
End If
form.de = numde
form.numero = k - 1
form.de = "M" & Format(Now(), "yymm") & Format(k - 1, "000")
End Sub
avec votre formule, il ne veut pas finir mon action si g rentre une valeur dans la textbox mais si j'utilise les optionbutton sa fonctionne nikel et g ne vois pas où g pu commetre une erreur
si vous arrivez a me corriger...
Merci