Banzai64 m'a fait un superbe code qui fonctionne parfaitement sur une feuille qui ne demande qu'une seule liste.
Mais j'ai d'autres feuilles où plusieurs listes doivent être dressées. Alors me suis dit que je devais copier-coller son code pour réaliser mes trois listes et j'y ai changé les cibles, mais ce n'est pas suffisant. Il doit y avoir une erreur dans la syntaxe du code ici-bas.
Quelqu'un pourrait-il vérifier ?
La première liste reprend bien les bonnes infos, mais pas la 2e liste ni la 3e
Sub ListeAtelierW()
Dim Plage As Range
Dim Cel As Range
Dim Tablo
Dim Indice As Integer
ActiveSheet.Unprotect Password:="mot de passe"
Application.ScreenUpdating = False
If Range("D34") <> "" Then
Range("D34:D60" & Range("D" & Rows.Count).End(xlUp).Row).ClearContents
End If
On Error Resume Next
Set Plage = Range("C5:T10").SpecialCells(xlCellTypeComments)
On Error GoTo 0
If Plage Is Nothing Then Exit Sub
ReDim Tablo(1 To Plage.Count, 1 To 1)
For Each Cel In Plage
Indice = Indice + 1
Tablo(Indice, 1) = Replace(Cel.Comment.Text, Chr(10), "")
Next Cel
Range("D34").Resize(Indice, 1) = Tablo
If Range("I34") <> "" Then
Range("I34:I60" & Range("I" & Rows.Count).End(xlUp).Row).ClearContents
End If
On Error Resume Next
Set Plage = Range("C14:T19").SpecialCells(xlCellTypeComments)
On Error GoTo 0
If Plage Is Nothing Then Exit Sub
ReDim Tablo(1 To Plage.Count, 1 To 1)
For Each Cel In Plage
Indice = Indice + 1
Tablo(Indice, 1) = Replace(Cel.Comment.Text, Chr(10), "")
Next Cel
Range("I34").Resize(Indice, 1) = Tablo
If Range("N34") <> "" Then
Range("N34:N60" & Range("N" & Rows.Count).End(xlUp).Row).ClearContents
End If
On Error Resume Next
Set Plage = Range("C23:T28").SpecialCells(xlCellTypeComments)
On Error GoTo 0
If Plage Is Nothing Then Exit Sub
ReDim Tablo(1 To Plage.Count, 1 To 1)
For Each Cel In Plage
Indice = Indice + 1
Tablo(Indice, 1) = Replace(Cel.Comment.Text, Chr(10), "")
Next Cel
Range("N34").Resize(Indice, 1) = Tablo
ActiveSheet.Protect Password:="mot de passe"
End Sub