Plantage de macro
Résolu
mchotard
Messages postés
474
Date d'inscription
Statut
Membre
Dernière intervention
-
redaiwa Messages postés 370 Statut Membre -
redaiwa Messages postés 370 Statut Membre -
Bonjour,
Quelqu'un pourrait-il m'expliquer pourquoi la macro ci-dessous plante une fois sur 2. Je n'arrive pas malgré de nombreux essai à trouver la cause du bogage
Range("A1:P105").Select
ActiveWorkbook.Worksheets("prépa facture").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("prépa facture").AutoFilter.Sort.SortFields.Add Key _
:=Range("A2:A105"), SortOn:=xlSortOnValues, Order:=xlAscending, _
DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("prépa facture").AutoFilter.Sort.SortFields.Add Key _
:=Range("C2:C105"), SortOn:=xlSortOnValues, Order:=xlAscending, _
DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("prépa facture").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
merci à tous
Quelqu'un pourrait-il m'expliquer pourquoi la macro ci-dessous plante une fois sur 2. Je n'arrive pas malgré de nombreux essai à trouver la cause du bogage
Range("A1:P105").Select
ActiveWorkbook.Worksheets("prépa facture").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("prépa facture").AutoFilter.Sort.SortFields.Add Key _
:=Range("A2:A105"), SortOn:=xlSortOnValues, Order:=xlAscending, _
DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("prépa facture").AutoFilter.Sort.SortFields.Add Key _
:=Range("C2:C105"), SortOn:=xlSortOnValues, Order:=xlAscending, _
DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("prépa facture").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
merci à tous
5 réponses
-
Merci pour avoir essayé, mais je pense que j'ai un problème selon que les filtres sont afficher ou pas quand je lance la macro.
Cdlt -
Salam mchotard.
Chez moi (Excel 2010), la macro ne plante pas.
"Repousse le mal par le bien; et voilà que celui avec qui tu avais une animosité devient tel un ami chaleureux" (Coran)
"Celui qui ne sait pas partager est infirme de ses émotions". (Marc Levy) -
bonjour
si tu peux donner un modele de ton fichier ca serait plus simple de voir ton probleme
A+
Maurice -
merci à tous ceux qui ont bien voulu s'intéresser à mon problème. C'est bon maintenant en insérant la formule de Salam
Cordialement -
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question -
Bonjour
eface le filtre avant
Sub TestFiltre()
Sheets("prépa facture").Select
If ActiveSheet.AutoFilterMode Then
ActiveSheet.AutoFilterMode = False
End If
Range("A1").AutoFilter
'
'
'
End Sub
A+
Maurice