Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Not Intersect(Target, Range("1:1")) Is Nothing Then
If Target = "" Then Exit Sub ' si cellule vide on sort
C = Target.Column - 1 ' sinon récupération du N° colonne ( -1 car données en C-1 )
With Frm_Image
.Txt_An = Target ' collage année
.Txt_Début = Cells(3, C) ' collage des données
.Txt_Fin = Cells(4, C)
.Txt_Etapes = Cells(5, C)
.Txt_Coureurs = Cells(6, C)
.Txt_Reste = Cells(7, C)
.Txt_Distance = Cells(8, C)
.Txt_Moyenne = Cells(9, C)
End With
DerLig = Cells(Rows.Count, C).End(xlUp).Row ' calcul dernière ligne
Chaine = ""
For i = 30 To DerLig
If Left(Cells(i, C), 5) = "Etape" Then ' on cherche les cellules qui commencent par Etape
Chaine = Chaine & Cells(i, C) & vbCrLf ' on l'ajoute à la chaine
End If
Next i
Frm_Image.TextBox1 = Chaine ' on transfert la chaine dans la textbox
Frm_Image.Show ' on visualise l'userform
End If
End Sub