Bonjour,

Cela va vous paraître simple, mais pour moi qui ai connu le tout début de la micro en 1973, ça bloque. Il y a/aura plusieurs autres feuilles interactives dont une pour les différentes interventions, il faut déjà que la première fonctionne.

Pour expliquer la macro ci-après (les Dim du début sont des reprises de vieilles macros) le problème:
- nbre de lignes qui va augmenter, je n'en suis pas encore à cette belle gestion du style "fenêtre automatique" vue sur le site, et bien loin de là
- nbre de colonnes qui pourrait augmenter
- une userform où doivent s'afficher 8 à 10 items de noms
- un commandButton1 Ok qui devrait me rendre la main pour savoir quelle ligne et quel nom a été sélectionné (topindes, text, ou value ?)
- un commandButton2 Annuler pour sortir si rien

Dans le commandButton1_click() il y a un tas de lignes ajoutées pour tester comme en fin de source, ne serait-ce que wtest pour savoir si cela passe par là en débogage, rien de rien.
Ne riez pas, ce n'est pas drôle, ayez pitié d'un vieux, merci.

J'ajoute que je n'ai jamais vu un site comme celui là, chapeau à vous contibuteurs, car en plus cela vous demande beaucoup de temps, et je serai bien incapabable de conseiller quelqu'un, merci encore,
bernard

p.s.
je viens de me rendre compte que le code une fois copié n'est pas indenté, tout aligné à gauche à l'affichage, pas facile à lire.
J'ai réindenté avec word, même résultat.

Nom : patients_xls.jpg
Affichages : 1090
Taille : 136,7 Ko

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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