Private Sub CommandButton1_Click()
Dim Sh, tablo()
Dim i As Byte
Dim feuille As Worksheet
Dim x As Integer
Dim c As Range
Dim rep As String, rep2 As String
If ListBox1.ListIndex = -1 Then Exit Sub
For Each Sh In Array("A", "B")
With Sheets(Sh)
For Each c In .Range(LetCol1 & "2:" & LetCol1 & .Range(LetCol1 & 65536).End(xlUp).Row)
If CStr(c) = ListBox1.Value Then
x = x + 1
ReDim Preserve tablo(1 To 20, 1 To x)
For i = 1 To 20
tablo(i, x) = .Cells(c.Row, i)
Next i
End If
Next c
End With
Next Sh
[B][COLOR=blue]Retour:[/COLOR][/B]
[B][COLOR=blue]rep = InputBox("Quel nom voulez vous donner à la feuille ?", "Titre a mettre", "valeur par défaut a l'ouverture")[/COLOR][/B]
[B][COLOR=blue]If rep = "" Then[/COLOR][/B]
[B][COLOR=blue] rep2 = MsgBox("Vous n'avez pas donné de nom de feuille." & Chr(10) & "Voulez vous saisir un nom de feuille maintenant ?", vbCritical + vbYesNo, "")[/COLOR][/B]
[B][COLOR=blue] If rep2 = vbYes Then GoTo Retour:[/COLOR][/B]
[B][COLOR=blue]Else[/COLOR][/B]
[B][COLOR=blue] Sheets("format").Copy before:=Sheets("format")[/COLOR][/B]
[B][COLOR=blue] ActiveSheet.Name = rep[/COLOR][/B]
[B][COLOR=blue]End If[/COLOR][/B]
[COLOR=green]'...[/COLOR]