1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
Private Sub CmBEnvoyer_Click()
Dim Derlign As Long
Dim Lig As Long
TBArrivee.Value = Format(TBArrivee.Value, "dd/mm/yy")
TBDepart.Value = Format(TBDepart.Value, "dd/mm/yy")
If Me.CBoxMaintenance.Value = True Then
With Worksheets("journal")
Derlign = .Range("a65536").End(xlUp).Row + 1
.Cells(Derlign, 1).Value = TBArrivee
.Cells(Derlign, 2).Value = TBDepart
.Cells(Derlign, 3).Value = "Maintenance"
.Cells(Derlign, 4).Value = "Maintenance"
.Cells(Derlign, 6).Value = CBChambre
.Cells(Derlign, 8).Value = "Maintenance"
End With
End If
If Me.CBoxMenage.Value = True Then
With Worksheets("journal")
Derlign = .Range("a65536").End(xlUp).Row + 1
.Cells(Derlign, 1).Value = TBArrivee
.Cells(Derlign, 1).Activate
.Cells(Derlign, 2).Value = TBDepart
.Cells(Derlign, 2).Activate
.Cells(Derlign, 3).Value = "Maintenance"
.Cells(Derlign, 4).Value = "Maintenance"
.Cells(Derlign, 6).Value = CBChambre
.Cells(Derlign, 8).Value = "Maintenance"
End With
End If
With Worksheets("journal")
Derlign = .Range("a65536").End(xlUp).Row + 1
.Cells(Derlign, 1).Value = TBArrivee
ActiveCell.FormulaR1C1 = TBArrivee
.Cells(Derlign, 2).Value = TBDepart
ActiveCell.FormulaR1C1 = TBDepart
.Cells(Derlign, 3).Value = TBNom
.Cells(Derlign, 4).Value = TBPrenom
.Cells(Derlign, 6).Value = CBChambre
.Cells(Derlign, 8).Value = TBIdVisiteur
End With
rep = MsgBox("Voulez-vous confirmer la saisie du nouveau client?", vbYesNoCancel + vbExclamation + vbDefaultButton2, "Validation des données")
If rep = vbYes Then
Unload Me 'on ferme userform
Else
If rep = vbNo Then
With Worksheets("journal")
Lig = .Range("A" & Rows.Count).End(xlUp).Row
.Cells(Lig, 1).Value = ""
.Cells(Lig, 2).Value = ""
.Cells(Lig, 3).Value = ""
.Cells(Lig, 4).Value = ""
.Cells(Lig, 6).Value = ""
.Cells(Lig, 8).Value = ""
End With
UsfSaisieNouv.Hide
End If
End If
'UsfValider.Show
End Sub |