Private Sub UserForm_Initialize()
li = ActiveCell.Row
co = ActiveCell.Column
HeureRDV.Value = Format("00:00", "hh:mm")
DateRDV.Value = Format(DateValue(Date), "dd/mm/yyyy")
dateappel.Value = Format(DateValue(Date), "dd/mm/yyyy")
DateRDV = Cells(li, 68)
HeureRDV = Cells(2, co).Text
Index_horaire = Cells(1, co)
Dim LastLig As Long
LastLig = Sheets("Données").Cells(Rows.Count, "G").End(xlUp).Row
Me.ComboBox1.RowSource = "Données!G2:G" & LastLig
ComboBox1 = Cells(3, 6) 'après le chargement de la combobox
End Sub
Private Sub Fixe_Change()
Dim Texte As String
Texte = Fixe.Text
Select Case Len(Texte)
Case 2, 5, 8, 11
Texte = Texte & " "
End Select
Fixe.Text = Texte
End Sub
Private Sub Portable_Change()
Dim Texte As String
Texte = Portable.Text
Select Case Len(Texte)
Case 2, 5, 8, 11
Texte = Texte & " "
End Select
Portable.Text = Texte
End Sub
Private Sub Valider_Click()
Application.ScreenUpdating = False
Sheets("RDV").Select
'Recuperation de la derniere ligne et inscription des données
Dim RDV As Integer
If NomPrenom <> "" Then
RDV = Range("a65000").End(xlUp).Row + 1
DateRDV.Value = Format(DateRDV.Value, "dd/mm/yyyy")
Cells(RDV, 1).Value = DateSerial(Right(dateappel, 4), Mid(dateappel, 4, 2), Left(dateappel, 2))
Cells(RDV, 2).Value = Prispar.Value
Cells(RDV, 6).Value = Avecqui.Value
Cells(RDV, 7).Value = NomPrenom.Value
Sheets("Mail").Cells(1, 3) = TextBoxMail
Sheets("Mail").Cells(1, 4) = NomPrenom.Value
Sheets("Mail").Cells(1, 5) = DateRDV
Sheets("Mail").Cells(1, 6) = HeureRDV
Cells(RDV, 9).Value = Adresse.Value
Cells(RDV, 10).Value = Parcelle.Value
Cells(RDV, 11).Value = Fixe.Value
Cells(RDV, 12).Value = Portable.Value
Cells(RDV, 13).Value = Courriel.Value
Cells(RDV, 14).Value = Objet.Value
Cells(RDV, 15).Value = TeneurRDV.Value
Cells(RDV, 16).Value = Actions.Value
Cells(RDV, 17).Value = Remarques.Value
Cells(RDV, 4).Value = DateSerial(Year(DateRDV.Value), Month(DateRDV.Value), Day(DateRDV.Value))
Cells(RDV, 5).Value = HeureRDV.Value
Cells(RDV, 3).Value = DA.Value
Cells(RDV, 18).Value = Index_horaire.Value
Cells(RDV, 19).Value = Index_collaborateur.Value
Else
MsgBox "Aucun enregistrement réalisé"
End If
Unload Me
Call EnvoyerMail22
On Error GoTo GestionErreur
Call TRI_RDV
Call SUPPRIMER
Sheets("Planning").Select
Range("a5").Select
ActiveWindow.ScrollRow = ActiveCell.Row
ActiveWindow.ScrollColumn = ActiveCell.Column
Application.ScreenUpdating = True
Exit Sub
GestionErreur:
Application.ScreenUpdating = True
End Sub