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 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
| Private Sub UserForm_initialize()
Dim nomID As String
nomID = InputBox("ID à modifier", "Consultation Patient")
Application.DisplayAlerts = False
Sheets(Array(nomID)).Select
ActiveWindow.SelectedSheets.Delete
Application.DisplayAlerts = True
CONSULTATION.id = nomID
Dim ligne As Integer
For ligne = 2 To 1000
If Cells(ligne, 1) = nomID Then
CONSULTATION.id = Cells(ligne, 1)
CONSULTATION.nom = Cells(ligne, 3)
CONSULTATION.prenom = Cells(ligne, 4)
CONSULTATION.tel = Cells(ligne, 5)
CONSULTATION.mail = Cells(ligne, 6)
CONSULTATION.naissance = Cells(ligne, 7)
CONSULTATION.motif = Cells(ligne, 9)
CONSULTATION.rdv2 = Cells(ligne, 11)
CONSULTATION.rdv3 = Cells(ligne, 12)
CONSULTATION.rdv4 = Cells(ligne, 13)
CONSULTATION.digestif = Cells(ligne, 14)
CONSULTATION.circulatoire = Cells(ligne, 15)
CONSULTATION.osseux = Cells(ligne, 16)
CONSULTATION.nerveux = Cells(ligne, 17)
CONSULTATION.autres = Cells(ligne, 18)
CONSULTATION.symptomes = Cells(ligne, 19)
CONSULTATION.medicament = Cells(ligne, 20)
CONSULTATION.conseil2 = Cells(ligne, 21)
CONSULTATION.obs2 = Cells(ligne, 22)
CONSULTATION.conseil3 = Cells(ligne, 23)
CONSULTATION.obs3 = Cells(ligne, 24)
CONSULTATION.conseil4 = Cells(ligne, 25)
CONSULTATION.obs4 = Cells(ligne, 26)
End If
Next ligne
End Sub
Private Sub CommandButton1_Click()
Dim MODIFICATION As String
MODIFICATION = id.Value
With ThisWorkbook.Sheets("PATIENT")
For i = Range("A" & .Rows.Count).End(xlUp).Row To 2 Step -1
If Range("A" & i).Value = MODIFICATION Then
Range("A" & i).Value = id.Value
Range("C" & i).Value = nom.Value
Range("D" & i).Value = prenom.Value
Range("E" & i).Value = tel.Value
Range("F" & i).Value = mail.Value
Range("G" & i).Value = naissance.Value
Range("I" & i).Value = motif.Value
Range("K" & i).Value = rdv2.Value
Range("L" & i).Value = rdv3.Value
Range("M" & i).Value = rdv4.Value
Range("N" & i).Value = digestif.Value
Range("O" & i).Value = circulatoire.Value
Range("P" & i).Value = osseux.Value
Range("Q" & i).Value = nerveux.Value
Range("R" & i).Value = autres.Value
Range("S" & i).Value = symptomes.Value
Range("T" & i).Value = medicament.Value
Range("U" & i).Value = conseil2.Value
Range("V" & i).Value = obs2.Value
Range("W" & i).Value = conseil3.Value
Range("X" & i).Value = obs3.Value
Range("Y" & i).Value = conseil4.Value
Range("Z" & i).Value = obs4.Value
End If
Next i
End With
Application.ScreenUpdating = False
'Application.OnTime Now + TimeValue("00:00:5"), "macro1"'
'Application.OnTime Now + TimeValue("00:00:10"), "macro2"'
Application.Run "Miseajour"
Unload CONSULTATION
End Sub
Private Sub CommandButton2_Click()
Unload CONSULTATION
End Sub
Private Sub naissance_Change()
Dim Valeur As Byte
naissance.MaxLength = 10 'nb caractères maxi autorisé dans le textbox
Valeur = Len(naissance)
If Valeur = 2 Or Valeur = 5 Then naissance = naissance & "/"
End Sub
Private Sub nom_Change()
nom.Text = UCase(nom.Text)
End Sub
Private Sub prenom_Change()
prenom.Value = WorksheetFunction.Proper(prenom.Value)
End Sub
Private Sub rdv2_Change()
Dim Valeur As Byte
rdv2.MaxLength = 10 'nb caractères maxi autorisé dans le textbox
Valeur = Len(rdv2)
If Valeur = 2 Or Valeur = 5 Then rdv2 = rdv2 & "/"
End Sub
Private Sub rdv3_Change()
Dim Valeur As Byte
rdv3.MaxLength = 10 'nb caractères maxi autorisé dans le textbox
Valeur = Len(rdv3)
If Valeur = 2 Or Valeur = 5 Then rdv3 = rdv3 & "/"
End Sub
Private Sub rdv4_Change()
Dim Valeur As Byte
rdv4.MaxLength = 10 'nb caractères maxi autorisé dans le textbox
Valeur = Len(rdv4)
If Valeur = 2 Or Valeur = 5 Then rdv4 = rdv4 & "/"
End Sub
Private Sub tel_Change()
Dim Texte As String
tel.MaxLength = 14
Texte = tel.Text
Select Case Len(Texte)
Case 2, 5, 8, 11
Texte = Texte & " "
End Select
tel.Text = Texte
End Sub |
Partager