Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Problème macro et excel 2002

2 réponses
Avatar
manu
Bonjour

J'ai fait une macro pour trier un tableau avec la méthode d'enregistrement
sous excel 2002
Elle fonctionne parfaitement mais que sur cette version d'excel
Sous excel 2000 j'ai cette erreur "Erreur de compilation - argument nommé
introuvable"
et me marque cette ligne " DataOption1:=xlSortNormal ".
Que faut-il modifier pour qu'elle fonctionne sur toute les versions d'excel?

Merci


Sub tri_tableau_manche_1()
'
' tri_tableau_manche_1 Macro
' Macro enregistrée le 06/10/2003 par Emmanuel
'

'
Sheets("Classement zone manche 1").Select
ActiveWindow.SmallScroll Down:=-12
ActiveSheet.Unprotect
Range("O5").Select
Range("A5:P25").Sort Key1:=Range("O6"), Order1:=xlDescending,
Key2:=Range _
("P6"), Order2:=xlDescending, Key3:=Range("A6"),
Order3:=xlAscending, _
Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:= _
xlTopToBottom, DataOption1:=xlSortNormal, DataOption2:=xlSortNormal,
_
DataOption3:=xlSortNormal
ActiveWindow.SmallScroll Down:=15
Range("O33").Select
Range("A33:P53").Sort Key1:=Range("O34"), Order1:=xlDescending, Key2:= _
Range("P34"), Order2:=xlDescending, Key3:=Range("A34"), Order3:= _
xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom, DataOption1:=xlSortNormal, DataOption2:=
_
xlSortNormal, DataOption3:=xlSortNormal
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True
ActiveWindow.SmallScroll Down:=-18
Sheets("Classement manche 1").Select
ActiveSheet.Unprotect
Range("O4").Select
Range("A4:P44").Sort Key1:=Range("O5"), Order1:=xlDescending,
Key2:=Range _
("P5"), Order2:=xlDescending, Key3:=Range("A5"),
Order3:=xlAscending, _
Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:= _
xlTopToBottom, DataOption1:=xlSortNormal, DataOption2:=xlSortNormal,
_
DataOption3:=xlSortNormal
ActiveWindow.SmallScroll Down:=0
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True
Sheets("Classement général").Select
ActiveSheet.Unprotect
Range("O4").Select
Range("A4:P44").Sort Key1:=Range("O5"), Order1:=xlDescending,
Key2:=Range _
("P5"), Order2:=xlDescending, Key3:=Range("A5"),
Order3:=xlAscending, _
Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:= _
xlTopToBottom, DataOption1:=xlSortNormal, DataOption2:=xlSortNormal,
_
DataOption3:=xlSortNormal
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True
ActiveSheet.EnableSelection = xlNoSelection
Sheets("Résultat manche 1").Select
End Sub

2 réponses

Avatar
Olivier
ton ererur de compil vient du fait qu'apres un signe = le mot clef n'est
pas reconnu par VB ( faute d'othographe par exemple)

DataOption1 Argument de type XlSortDataOption facultatif. Indique comment
trier le texte dans la clé 1. Cet argument ne peut être utilisé lors du tri
de rapports de tableau croisé dynamique.




"manu" <moulin.martin(nospam)@free.fr> a écrit dans le message de news:
3f85c668$0$27570$
Bonjour

J'ai fait une macro pour trier un tableau avec la méthode d'enregistrement
sous excel 2002
Elle fonctionne parfaitement mais que sur cette version d'excel
Sous excel 2000 j'ai cette erreur "Erreur de compilation - argument nommé
introuvable"
et me marque cette ligne " DataOption1:=xlSortNormal ".
Que faut-il modifier pour qu'elle fonctionne sur toute les versions
d'excel?


Merci


Sub tri_tableau_manche_1()
'
' tri_tableau_manche_1 Macro
' Macro enregistrée le 06/10/2003 par Emmanuel
'

'
Sheets("Classement zone manche 1").Select
ActiveWindow.SmallScroll Down:=-12
ActiveSheet.Unprotect
Range("O5").Select
Range("A5:P25").Sort Key1:=Range("O6"), Order1:=xlDescending,
Key2:=Range _
("P6"), Order2:=xlDescending, Key3:=Range("A6"),
Order3:=xlAscending, _
Header:=xlGuess, OrderCustom:=1, MatchCase:úlse, Orientation:= _
xlTopToBottom, DataOption1:=xlSortNormal,
DataOption2:=xlSortNormal,

_
DataOption3:=xlSortNormal
ActiveWindow.SmallScroll Down:
Range("O33").Select
Range("A33:P53").Sort Key1:=Range("O34"), Order1:=xlDescending, Key2: _
Range("P34"), Order2:=xlDescending, Key3:=Range("A34"), Order3:= _
xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:úlse, _
Orientation:=xlTopToBottom, DataOption1:=xlSortNormal,
DataOption2: > _

xlSortNormal, DataOption3:=xlSortNormal
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True
ActiveWindow.SmallScroll Down:=-18
Sheets("Classement manche 1").Select
ActiveSheet.Unprotect
Range("O4").Select
Range("A4:P44").Sort Key1:=Range("O5"), Order1:=xlDescending,
Key2:=Range _
("P5"), Order2:=xlDescending, Key3:=Range("A5"),
Order3:=xlAscending, _
Header:=xlGuess, OrderCustom:=1, MatchCase:úlse, Orientation:= _
xlTopToBottom, DataOption1:=xlSortNormal,
DataOption2:=xlSortNormal,

_
DataOption3:=xlSortNormal
ActiveWindow.SmallScroll Down:=0
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True
Sheets("Classement général").Select
ActiveSheet.Unprotect
Range("O4").Select
Range("A4:P44").Sort Key1:=Range("O5"), Order1:=xlDescending,
Key2:=Range _
("P5"), Order2:=xlDescending, Key3:=Range("A5"),
Order3:=xlAscending, _
Header:=xlGuess, OrderCustom:=1, MatchCase:úlse, Orientation:= _
xlTopToBottom, DataOption1:=xlSortNormal,
DataOption2:=xlSortNormal,

_
DataOption3:=xlSortNormal
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True
ActiveSheet.EnableSelection = xlNoSelection
Sheets("Résultat manche 1").Select
End Sub




Avatar
manu
Désolé Olivier j'ai fait une petite erreur de manip et j'ai répondu perso,
je reposte donc sur le forum

Merci de intéresser à mon problème
Je l'ai fait avec l'enregistreur et elle s'est donc écrit toute seule dans
VB
Elle fonctionne sous excel 2002 donc dans cette version VB la reconnaît bien
sans détecter de problème.
La version de VB sous excel 2000 serait-elle si différente qu'elle ne
reconnaît pas les macros faites avec la version de VB de excel 2002 ?
Ou est-ce la methode avec l'enregistreur qui fait qu'un macro écrit sous une
version ne fonctionne pas avec une autre?

Ce n'est pas un tableau croisé dynamique. Cette macro tri plusieurs tableaux
à la suite
sous trois conditions différentes.
@+Manu

"Olivier" a écrit dans le message de news:
bm4llf$cgp$
ton ererur de compil vient du fait qu'apres un signe = le mot clef n'est
pas reconnu par VB ( faute d'othographe par exemple)

DataOption1 Argument de type XlSortDataOption facultatif. Indique comment
trier le texte dans la clé 1. Cet argument ne peut être utilisé lors du
tri

de rapports de tableau croisé dynamique.




"manu" <moulin.martin(nospam)@free.fr> a écrit dans le message de news:
3f85c668$0$27570$
Bonjour

J'ai fait une macro pour trier un tableau avec la méthode
d'enregistrement


sous excel 2002
Elle fonctionne parfaitement mais que sur cette version d'excel
Sous excel 2000 j'ai cette erreur "Erreur de compilation - argument
nommé


introuvable"
et me marque cette ligne " DataOption1:=xlSortNormal ".
Que faut-il modifier pour qu'elle fonctionne sur toute les versions
d'excel?


Merci


Sub tri_tableau_manche_1()
'
' tri_tableau_manche_1 Macro
' Macro enregistrée le 06/10/2003 par Emmanuel
'

'
Sheets("Classement zone manche 1").Select
ActiveWindow.SmallScroll Down:=-12
ActiveSheet.Unprotect
Range("O5").Select
Range("A5:P25").Sort Key1:=Range("O6"), Order1:=xlDescending,
Key2:=Range _
("P6"), Order2:=xlDescending, Key3:=Range("A6"),
Order3:=xlAscending, _
Header:=xlGuess, OrderCustom:=1, MatchCase:úlse, Orientation: _
xlTopToBottom, DataOption1:=xlSortNormal,
DataOption2:=xlSortNormal,

_
DataOption3:=xlSortNormal
ActiveWindow.SmallScroll Down:
Range("O33").Select
Range("A33:P53").Sort Key1:=Range("O34"), Order1:=xlDescending,
Key2: > _


Range("P34"), Order2:=xlDescending, Key3:=Range("A34"), Order3: _
xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:úlse,
_


Orientation:=xlTopToBottom, DataOption1:=xlSortNormal,
DataOption2: > > _

xlSortNormal, DataOption3:=xlSortNormal
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True
ActiveWindow.SmallScroll Down:=-18
Sheets("Classement manche 1").Select
ActiveSheet.Unprotect
Range("O4").Select
Range("A4:P44").Sort Key1:=Range("O5"), Order1:=xlDescending,
Key2:=Range _
("P5"), Order2:=xlDescending, Key3:=Range("A5"),
Order3:=xlAscending, _
Header:=xlGuess, OrderCustom:=1, MatchCase:úlse, Orientation: _
xlTopToBottom, DataOption1:=xlSortNormal,
DataOption2:=xlSortNormal,

_
DataOption3:=xlSortNormal
ActiveWindow.SmallScroll Down:=0
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True
Sheets("Classement général").Select
ActiveSheet.Unprotect
Range("O4").Select
Range("A4:P44").Sort Key1:=Range("O5"), Order1:=xlDescending,
Key2:=Range _
("P5"), Order2:=xlDescending, Key3:=Range("A5"),
Order3:=xlAscending, _
Header:=xlGuess, OrderCustom:=1, MatchCase:úlse, Orientation: _
xlTopToBottom, DataOption1:=xlSortNormal,
DataOption2:=xlSortNormal,

_
DataOption3:=xlSortNormal
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True
ActiveSheet.EnableSelection = xlNoSelection
Sheets("Résultat manche 1").Select
End Sub