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
| Public nocellule, noligne, nocolonn, nb_ligne, nb_colonn, windex, i As Long
Public numeros_lignes(), rang_trouve As Long
Public cellulfin_tableau, lignfin_tableau, wmessage, wcr, wlf, wcrlf As String
Public search_nom, alphabet, wsP, wbP, nom_trouve, wtest, wtrace As String
Public myobjet, mysheet, myform As Object
Public CommandButton1 As Control
Public CommandButton2 As Control
__________________________________________
Private Sub CommandButton1_Click()
wtest = "1"
If Form_choix_patient.CommandButton1.Caption = "OK" Then 'Check caption, then change it.
With Form_choix_patient.CommandButton1
.Caption = "Clicked"
.Accelerator = "C"
End With
Else
With Form_choix_patient.CommandButton1
.Caption = "OK"
.Accelerator = "O"
'Set Accelerator key to COMMAND + O
End With
End If
With Form_choix_patient.ListBox1
nom_trouve = .Text
rang_trouve = .TopIndex
'-nom_trouve = .Value
End With
Unload Form_choix_patient '-ou .Show False
End Sub
Private Sub CommandButton2_Click()
MsgBox ("bouton2") '-, vbDefaultButton2) = vbCancel
wtest = "2"
Unload Form_choix_patient
End Sub
_______________________________________
Private Sub Form_choix_patient_initialize()
wtest = "0"
'---si X colonnes
'- ListBox1.ColumnCount = plage.Columns.Count
Form_choix_patient.ListBox1.List() = Range("A2:A" + Trim(Str(nb_ligne - 1))).Value
For i = 1 To nb_ligne '--numérotage lignes pour l'instant ne sert à rien
If Cells(i, 1) <> vbNullString Then
ReDim Preserve numeros_lignes(1 To i): numeros_lignes(i) = i
End If
Next i
i = i - 1
End Sub
_________________________________________
Sub Choix_du_patient()
wtest = "d"
wcr = Chr(13): wlf = Chr(10): wcrlf = wcr + wlf
alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
wbP = "Patients.xlsm"
wsP = "Patients"
wtrace = "Gestion_traçabilité.xlsm"
Workbooks(wbP).Activate
Worksheets(wsP).Activate
'-nb_colonn = Range("A1").SpecialCells(xlCellTypeLastCell).Column '--avec vides
nb_colonn = ActiveSheet.Cells(1, Application.Columns.Count).End(xlToLeft).Column '-avec vides
dern_colonn = Mid(alphabet, nb_colonn, 1)
nb_ligne = Range("A1").SpecialCells(xlCellTypeLastCell).Row '--avec vides
'---tri croissant
ActiveWorkbook.Worksheets(wsP).Sort.SortFields.Clear
ActiveWorkbook.Worksheets(wsP).Sort.SortFields.Add Key:=Range("A2"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets(wsP).Sort
.SetRange Range("A2:" + dern_colonn + Trim(Str(nb_ligne)))
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
'---coloriage doublons
Columns("A:A").Select
Selection.FormatConditions.Delete
Selection.FormatConditions.AddUniqueValues
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
Selection.FormatConditions(1).DupeUnique = xlDuplicate
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 10092441
.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False
'--recalcul une fois vides supprimés
nb_ligne = Application.CountA(Sheets("Patients").Range("A:A"))
'-Range("a2").Select
'-CommandButton1_Click
'-CommandButton2_Click
Form_choix_patient_initialize
Form_choix_patient.Show
With Form_choix_patient.ListBox1
rang_trouve = .ListIndex
End With 'Form_choix_patient.Hide
suite:
If Form_choix_patient.ListBox1.ListIndex = -1 Then
Form_choix_patient.Show False
'-Exit Sub
End If
sortie:
Workbooks(wtrace).Activate |
Partager