bonjour,
C'est a ligne Set rng qui cloche mais elle n'est pas la seule...
Le code modifié :
Private Sub CommandButton1_Click()
SaisieENEM.Hide '******
End Sub
Private Sub ListeSection_Change()
Dim Col As Long
Col = 1 + Me.ListeSection.ListIndex
If Col >= 0 Then
With Sheets("prépa")
Me.ListeSousSection.List = .Range(.Cells(2, Col), .Cells(Rows.Count, Col).End(xlUp)).Value
End With
End If
End Sub
Private Sub UserForm_Initialize()
Dim Rng As Range
With Sheets("prépa")
Set Rng = .Range(.Cells(1, 1), .Cells(1, (.Cells(Columns.Count).End(xlToLeft).Column))) '******
'Rng.Select '******
Me.ListeSection.List = Application.Transpose(Rng)
End With
End Sub
Private Sub Userform_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode <> vbFormCode Then
Cancel = True
End If
End Sub
Il y a différentes façons de voire la chose mais je suis resté dans "votre esprit"
les lignes marquée '******* sont les lignes modifiées.
Dans le fichier joint j'ai adopté une autre méthode, j'ai corrigé en créant le nom "sections" dans le gestionnaire de noms, ça simplifie quand même pas mal la prog ! (il faut d'abord pensez Excel...)
A+