Problème erreur 91
Résolu/Fermé
A voir également:
- Problème erreur 91
- Erreur 1004 vba ✓ - Forum VB / VBA
- Erreur 1000 france tv - Forum MacOS
- Youtube une erreur s'est produite ✓ - Forum YouTube
- Free erreur 38 ✓ - Forum Mobile
- Erreur 91 vba ✓ - Forum VB / VBA
3 réponses
Patrice33740
Messages postés
8556
Date d'inscription
dimanche 13 juin 2010
Statut
Membre
Dernière intervention
2 mars 2023
1 762
Modifié par Patrice33740 le 16/09/2016 à 16:08
Modifié par Patrice33740 le 16/09/2016 à 16:08
Bonjour,
L'erreur 91, c'est parce que le filtre n'existe pas !
Cordialement
Patrice
L'erreur 91, c'est parce que le filtre n'existe pas !
'Tri des alertes
With ActiveWorkbook.Worksheets("Alertes")
.Activate
.Rows(ccc & ":" & ccc).Delete
If .AutoFilter Is Nothing Then
.Range("A1").AutoFilter 'Ou autre si c'est pas la ligne 1
Else
.ShowAllData
.AutoFilter.Sort.SortFields.Clear
End If
' etc ...
End With
Cordialement
Patrice
Bonjour, merci pour votre aide mais meme après modifs la macro m'affiche toujours cette erreur
Patrice33740
Messages postés
8556
Date d'inscription
dimanche 13 juin 2010
Statut
Membre
Dernière intervention
2 mars 2023
1 762
19 sept. 2016 à 14:48
19 sept. 2016 à 14:48
Bonjour,
Essaies de remplacer ton code ci dessus par celui-ci (à adapter : si besoin remplacer A1 par la première cellule du tableau de données, i.e.en haut à droite) :
Essaies de remplacer ton code ci dessus par celui-ci (à adapter : si besoin remplacer A1 par la première cellule du tableau de données, i.e.en haut à droite) :
'Tri des alertes
With ActiveWorkbook.Worksheets("Alertes")
.Activate
.Rows(ccc & ":" & ccc).Delete
If .AutoFilter Is Nothing Then
.Range("A1").AutoFilter 'Ou autre si le tableau n'est pas en A1
Else
.ShowAllData
.AutoFilter.Sort.SortFields.Clear
End If
With .AutoFilter.Sort
.SortFields.Add(Range("E4:E5"), xlSortOnCellColor, xlAscending, , _
xlSortNormal).SortOnValue.Color = RGB(255, 192, 0)
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End With
Modifié par Lucas922 le 19/09/2016 à 10:43
La macro plante au niveau de l'instruction en gras
Merci beaucoup
''Tri des alertes
ActiveWorkbook.Sheets("Alertes").Activate
ActiveWorkbook.Worksheets("Alertes").Rows(ccc & ":" & ccc).Delete
ActiveWorkbook.Worksheets("Alertes").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Alertes").AutoFilter.Sort.SortFields.Add(Range( _
"E4:E5"), xlSortOnCellColor, xlAscending, , xlSortNormal).SortOnValue.Color = _
RGB(255, 192, 0)
With ActiveWorkbook.Worksheets("Alertes").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
ActiveWorkbook.Worksheets("Alertes").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Alertes").AutoFilter.Sort.SortFields.Add(Range( _
"E4:E5"), xlSortOnCellColor, xlAscending, , xlSortNormal).SortOnValue.Color = _
RGB(255, 0, 0)
With ActiveWorkbook.Worksheets("Alertes").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
Que dois-je corriger exactement ?
Cordialement