Bonjour,
Je ne sais pas qui t'a écrit le programme mais... ouah... pas ouah parce que c'est bien écrit hein, mais ouah parce que ce n'est pas écrit pour être modifié!
Des déclarations n'importe comment, des façons d'écrire que je déteste etc etc...
J'ai commencé à réécrire un peu le programme pour qu'il soit déjà plus lisible mais ça va être compliqué pour le bas du code, je mets là où j'en suis ici:
Sub CpyData()
Application.ScreenUpdating = 0
On Error GoTo ErrFeuille
Dim sh1 As Worksheet, sh2 As Worksheet, sh3 As Worksheet
Dim dlig&, nlm&, chn$, lig&
Dim plg As Range
nlm = Range("a" & Rows.Count).End(xlUp).Row 'dernière ligne remplie
Set sh1 = Worksheets("récap du choix")
Set sh2 = Worksheets(chn) 'y'aura peut-être ErrFeuille !
Set sh3 = Worksheets("tableau général")
chn = [B7]
dlig = Cells(nlm, 1).End(3).Row
If ActiveSheet.Name <> sh1.Name Or dlig = 13 Or chn = "" Then
Exit Sub
End If
Range("A14:N" & dlig).Copy
sh2.Select
lig = Cells(nlm, 1).End(3)(2).Row
Cells(lig, 1).PasteSpecial -4163
lig = Cells(nlm, 1).End(3).Row
[A1].Select: Set plg = Range("A3:N" & lig)
With Worksheets("tableau général")
plg.Sort [B3], 1
plg.Copy: lig = .Cells(nlm, 1).End(3)(2).Row
.Cells(lig, 1).PasteSpecial -4163
Application.CutCopyMode = 0
.Select
[A1].Select
End With
sh1.Select
MsgBox "Copie effectuée.", 64, "CpyData": Exit Sub
ErrFeuille:
MsgBox "La feuille """ & [B7] & """ n'existe pas.", 48, "Erreur"
End Sub