Une commande botton dans un command button

mickaelcorm Messages postés 4 Date d'inscription mercredi 11 août 2010 Statut Membre Dernière intervention 5 juillet 2011 - 5 juil. 2011 à 11:01
mickaelcorm Messages postés 4 Date d'inscription mercredi 11 août 2010 Statut Membre Dernière intervention 5 juillet 2011 - 5 juil. 2011 à 11:41
Bonjour

Je renvoie pour la dexiéme fois le même message car ne sachant pas si le premier est arrivé.

voici le code

Private Sub Cmdrecherche_Click()
Dim Cmdmodif As Boolean


If Me.Rech = "" Then Exit Sub
Application.DisplayAlerts = False
On Error Resume Next
Sheets("Temp").Delete
On Error GoTo 0
Sheets.Add after:=Sheets(Sheets.Count)
ActiveSheet.Name = "Temp"
'----------------------------------------
ligne = 2
For i = 1 To Sheets.Count - 1
With Sheets(i).Cells
Set C = .Find(Me.Rech, LookIn:=xlValues, LookAt:=xlWhole)
If Not C Is Nothing Then
premier = C.Address
Do
DTPicker1.Value = Sheets(i).Cells(ligne, 1).Value
ComboBox1 = Sheets(i).Cells(ligne, 2).Value
TJ = Sheets(i).Cells(ligne, 3).Value
Km = Sheets(i).Cells(ligne, 4).Value

TR = Format(Sheets(i).Cells(ligne, 5).Value, "hh:mm")
TE = Format(Sheets(i).Cells(ligne, 6).Value, "hh:mm")
TF = Format(Sheets(i).Cells(ligne, 7).Value, "hh:mm")
ComboBox2 = Sheets(i).Cells(ligne, 8).Value
LO = Format(Sheets(i).Cells(ligne, 9).Value, "hh:mm")
HS = Format(Sheets(i).Cells(ligne, 10).Value, "hh:mm")
TOTAL = Format(Sheets(i).Cells(ligne, 11).Value, "hh:mm")

'notation par de devis ---- devis 1

OSR1 = Sheets(i).Cells(ligne, 12).Value

OptionButton111 = Sheets(i).Cells(ligne, 13).Value
OptionButton112 = Sheets(i).Cells(ligne, 14).Value
OptionButton113 = Sheets(i).Cells(ligne, 15).Value
OptionButton114 = Sheets(i).Cells(ligne, 16).Value
OptionButton121 = Sheets(i).Cells(ligne, 17).Value
OptionButton122 = Sheets(i).Cells(ligne, 18).Value
OptionButton123 = Sheets(i).Cells(ligne, 19).Value
OptionButton124 = Sheets(i).Cells(ligne, 20).Value
CheckBox1 = Sheets(i).Cells(ligne, 21).Value
CheckBox2 = Sheets(i).Cells(ligne, 22).Value
OptionButton131 = Sheets(i).Cells(ligne, 23).Value
OptionButton132 = Sheets(i).Cells(ligne, 24).Value
OptionButton133 = Sheets(i).Cells(ligne, 25).Value
OptionButton134 = Sheets(i).Cells(ligne, 26).Value
OptionButton141 = Sheets(i).Cells(ligne, 27).Value
OptionButton142 = Sheets(i).Cells(ligne, 28).Value
OptionButton143 = Sheets(i).Cells(ligne, 29).Value
OptionButton144 = Sheets(i).Cells(ligne, 30).Value
OptionButton151 = Sheets(i).Cells(ligne, 31).Value
OptionButton152 = Sheets(i).Cells(ligne, 32).Value
OptionButton153 = Sheets(i).Cells(ligne, 33).Value
OptionButton154 = Sheets(i).Cells(ligne, 34).Value
OptionButton155 = Sheets(i).Cells(ligne, 35).Value
OptionButton156 = Sheets(i).Cells(ligne, 36).Value
OptionButton157 = Sheets(i).Cells(ligne, 37).Value
OptionButton158 = Sheets(i).Cells(ligne, 38).Value
OptionButton159 = Sheets(i).Cells(ligne, 39).Value
OptionButton1510 = Sheets(i).Cells(ligne, 40).Value
OptionButton161 = Sheets(i).Cells(ligne, 41).Value
OptionButton162 = Sheets(i).Cells(ligne, 42).Value
RD1 = Sheets(i).Cells(ligne, 43).Value


Set C = .FindNext(C)
Loop While Not C Is Nothing And C.Address <> premier
End If
End With
Next i


'-------------------------------- Validation de la modification-------------------------------------
Set modif = Command.Cmdmodif.Click


msg1 = MsgBox(" Voulez-vous modifier ? ", vbYesNo + vbQuestion, "Confirmation")

If msg1 = vbYes Then

With .modif = True

Sheets(i).Cells(ligne, 1).Value = CDate(DTPicker1.Value)
Sheets(i).Cells(ligne, 2).Value = ComboBox1
Sheets(i).Cells(ligne, 3).Value = CDec(TJ)
Sheets(i).Cells(ligne, 4).Value = CDec(Km)
Sheets(i).Cells(ligne, 5).Value = Format(CDate(Me.TR), "hh:mm")
Sheets(i).Cells(ligne, 6).Value = Format(CDate(Me.TE), "hh:mm")
Sheets(i).Cells(ligne, 7).Value = Format(CDate(Me.TF), "hh:mm")
Sheets(i).Cells(ligne, 8).Value = ComboBox2
Sheets(i).Cells(ligne, 9).Value = Format(CDate(Me.LO), "hh:mm")
Sheets(i).Cells(ligne, 10).Value = Format(CDate(Me.HS), "hh:mm")
Sheets(i).Cells(ligne, 10).Value = Format(CDate(Me.TOTAL), "hh:mm")
'notation par de devis ---- devis 1

Sheets(i).Cells(ligne, 11).Value = CDbl(OSR1)
Sheets(i).Cells(ligne, 12).Value = OptionButton111
Sheets(i).Cells(ligne, 13).Value = OptionButton112
Sheets(i).Cells(ligne, 14).Value = OptionButton113
Sheets(i).Cells(ligne, 15).Value = OptionButton114
Sheets(i).Cells(ligne, 16).Value = OptionButton121
Sheets(i).Cells(ligne, 17).Value = OptionButton122
Sheets(i).Cells(ligne, 18).Value = OptionButton123
Sheets(i).Cells(ligne, 19).Value = OptionButton124
Sheets(i).Cells(ligne, 20).Value = CheckBox1
Sheets(i).Cells(ligne, 21).Value = CheckBox2
Sheets(i).Cells(ligne, 22).Value = OptionButton131
Sheets(i).Cells(ligne, 23).Value = OptionButton132
Sheets(i).Cells(ligne, 24).Value = OptionButton133
Sheets(i).Cells(ligne, 25).Value = OptionButton134
Sheets(i).Cells(ligne, 26).Value = OptionButton141
Sheets(i).Cells(ligne, 27).Value = OptionButton142
Sheets(i).Cells(ligne, 28).Value = OptionButton143
Sheets(i).Cells(ligne, 29).Value = OptionButton144
Sheets(i).Cells(ligne, 30).Value = OptionButton151
Sheets(i).Cells(ligne, 31).Value = OptionButton152
Sheets(i).Cells(ligne, 32).Value = OptionButton153
Sheets(i).Cells(ligne, 33).Value = OptionButton154
Sheets(i).Cells(ligne, 34).Value = OptionButton155
Sheets(i).Cells(ligne, 35).Value = OptionButton156
Sheets(i).Cells(ligne, 36).Value = OptionButton157
Sheets(i).Cells(ligne, 37).Value = OptionButton158
Sheets(i).Cells(ligne, 38).Value = OptionButton159
Sheets(i).Cells(ligne, 39).Value = OptionButton1510
Sheets(i).Cells(ligne, 40).Value = OptionButton161
Sheets(i).Cells(ligne, 41).Value = OptionButton161
Sheets(i).Cells(ligne, 42).Value = CDbl(RD1)


End With

End If
pass:


End Sub


Ma question est comment introduire un click botton d'un autre bouton pour valider mes modifs à ma fiche initiale.

Car je ne veux pas perdre la feuille et la ligne d'origine pour aller l'écraser par les nouvelles valeurs.


Merci

1 réponse

mickaelcorm Messages postés 4 Date d'inscription mercredi 11 août 2010 Statut Membre Dernière intervention 5 juillet 2011
5 juil. 2011 à 11:41
Bon j'ai parcouru le net

Donc pour être plus précis.

Je veux introduire dans une séquence sub command_button ()

un deuxiéme boutton de ma userform.

Apparament je dois allé chercher sa command click par le biais d'un set "cmd" = commandblabla

et faire un whith command".cmd"

mais bon trop faible pour y arrviver de l'aide serai la bienvenue

Merci
0
Rejoignez-nous