Macro fonctionne sur 2016 mais pas sur 2007
Fermé
Davy
-
20 juin 2017 à 06:12
f894009 Messages postés 17205 Date d'inscription dimanche 25 novembre 2007 Statut Membre Dernière intervention 19 octobre 2024 - 22 juin 2017 à 13:49
f894009 Messages postés 17205 Date d'inscription dimanche 25 novembre 2007 Statut Membre Dernière intervention 19 octobre 2024 - 22 juin 2017 à 13:49
A voir également:
- Macro fonctionne sur 2016 mais pas sur 2007
- Telecharger macro convertir chiffre en lettre excel - Télécharger - Tableur
- Save pdf office 2007 - Télécharger - Bureautique
- Macro word - Guide
- Macro logiciel - Télécharger - Organisation
- Macro recorder - Télécharger - Confidentialité
1 réponse
f894009
Messages postés
17205
Date d'inscription
dimanche 25 novembre 2007
Statut
Membre
Dernière intervention
19 octobre 2024
1 709
20 juin 2017 à 06:30
20 juin 2017 à 06:30
Bonjour,
Montrez le code avec la ligne en erreur
Montrez le code avec la ligne en erreur
22 juin 2017 à 06:18
Voici le code :
Erreur arrive dans le block 07 sur la ligne :
ActiveSheet.Range("$A$2:$M$1045658").RemoveDuplicates Columns:=10, Header:= _
xlYes
Sub block01()
Sheets("block 01").Select
Columns("A:M").Select
Selection.ClearContents
Columns("A:A").Select
Sheets("DATA BASE").Select
ActiveSheet.Range("$A$2:$AH$3061").AutoFilter Field:=31, Criteria1:="1"
Columns("A:AG").Select
Selection.Copy
Sheets("block 01").Select
Columns("A:A").Select
ActiveSheet.Paste
Columns("J:J").Select
Application.CutCopyMode = False
ActiveSheet.Range("$A$2:$M$1045658").RemoveDuplicates Columns:=10, Header:= _
xlYes
End Sub
Sub block02()
Sheets("block 02").Select
Columns("A:M").Select
Selection.ClearContents
Columns("A:A").Select
Sheets("DATA BASE").Select
ActiveSheet.showalldata
ActiveSheet.Range("$A$2:$AH$3061").AutoFilter Field:=31, Criteria1:="2"
Columns("A:AG").Select
Selection.Copy
Sheets("block 02").Select
Columns("A:A").Select
ActiveSheet.Paste
Columns("J:J").Select
Application.CutCopyMode = False
ActiveSheet.Range("$A$2:$M$1045658").RemoveDuplicates Columns:=10, Header:= _
xlYes
End Sub
Sub block03()
Sheets("block 03").Select
Columns("A:M").Select
Selection.ClearContents
Columns("A:A").Select
Sheets("DATA BASE").Select
ActiveSheet.showalldata
ActiveSheet.Range("$A$2:$AH$3061").AutoFilter Field:=31, Criteria1:="3"
Columns("A:AG").Select
Selection.Copy
Sheets("block 03").Select
Columns("A:A").Select
ActiveSheet.Paste
Columns("J:J").Select
Application.CutCopyMode = False
ActiveSheet.Range("$A$2:$M$1045658").RemoveDuplicates Columns:=10, Header:= _
xlYes
End Sub
Sub block04()
Sheets("block 04").Select
Columns("A:M").Select
Selection.ClearContents
Columns("A:A").Select
Sheets("DATA BASE").Select
ActiveSheet.showalldata
ActiveSheet.Range("$A$2:$AH$3061").AutoFilter Field:=31, Criteria1:="4"
Columns("A:AG").Select
Selection.Copy
Sheets("block 04").Select
Columns("A:A").Select
ActiveSheet.Paste
Columns("J:J").Select
Application.CutCopyMode = False
ActiveSheet.Range("$A$2:$M$1045658").RemoveDuplicates Columns:=10, Header:= _
xlYes
End Sub
Sub block05()
Sheets("block 05").Select
Columns("A:M").Select
Selection.ClearContents
Columns("A:A").Select
Sheets("DATA BASE").Select
ActiveSheet.showalldata
ActiveSheet.Range("$A$2:$AH$3061").AutoFilter Field:=31, Criteria1:="5"
Columns("A:AG").Select
Selection.Copy
Sheets("block 05").Select
Columns("A:A").Select
ActiveSheet.Paste
Columns("J:J").Select
Application.CutCopyMode = False
ActiveSheet.Range("$A$2:$M$1045658").RemoveDuplicates Columns:=10, Header:= _
xlYes
End Sub
Sub block06()
Sheets("block 06").Select
Columns("A:M").Select
Selection.ClearContents
Columns("A:A").Select
Sheets("DATA BASE").Select
ActiveSheet.showalldata
ActiveSheet.Range("$A$2:$AH$3061").AutoFilter Field:=31, Criteria1:="6"
Columns("A:AG").Select
Selection.Copy
Sheets("block 06").Select
Columns("A:A").Select
ActiveSheet.Paste
Columns("J:J").Select
Application.CutCopyMode = False
ActiveSheet.Range("$A$2:$M$1045658").RemoveDuplicates Columns:=10, Header:= _
xlYes
End Sub
Sub block07()
Sheets("block 07").Select
Columns("A:M").Select
Selection.ClearContents
Columns("A:A").Select
Sheets("DATA BASE").Select
ActiveSheet.showalldata
ActiveSheet.Range("$A$2:$AH$3061").AutoFilter Field:=31, Criteria1:="7"
Columns("A:AG").Select
Selection.Copy
Sheets("block 07").Select
Columns("A:A").Select
ActiveSheet.Paste
Columns("J:J").Select
Application.CutCopyMode = False
ActiveSheet.Range("$A$2:$M$1045658").RemoveDuplicates Columns:=10, Header:= _
xlYes
End Sub
Sub block08()
Sheets("block 08").Select
Columns("A:M").Select
Selection.ClearContents
Columns("A:A").Select
Sheets("DATA BASE").Select
ActiveSheet.showalldata
ActiveSheet.Range("$A$2:$AH$3061").AutoFilter Field:=31, Criteria1:="8"
Columns("A:AG").Select
Selection.Copy
Sheets("block 08").Select
Columns("A:A").Select
ActiveSheet.Paste
Columns("J:J").Select
Application.CutCopyMode = False
ActiveSheet.Range("$A$2:$M$1045658").RemoveDuplicates Columns:=10, Header:= _
xlYes
End Sub
Sub block09()
Sheets("block 09").Select
Columns("A:M").Select
Selection.ClearContents
Columns("A:A").Select
Sheets("DATA BASE").Select
ActiveSheet.showalldata
ActiveSheet.Range("$A$2:$AH$3061").AutoFilter Field:=31, Criteria1:="9"
Columns("A:AG").Select
Selection.Copy
Sheets("block 09").Select
Columns("A:A").Select
ActiveSheet.Paste
Columns("J:J").Select
Application.CutCopyMode = False
ActiveSheet.Range("$A$2:$M$1045658").RemoveDuplicates Columns:=10, Header:= _
xlYes
End Sub
Sub block21()
Sheets("block 21").Select
Columns("A:M").Select
Selection.ClearContents
Columns("A:A").Select
Sheets("DATA BASE").Select
ActiveSheet.showalldata
ActiveSheet.Range("$A$2:$AH$3061").AutoFilter Field:=31, Criteria1:="21"
Columns("A:AG").Select
Selection.Copy
Sheets("block 21").Select
Columns("A:A").Select
ActiveSheet.Paste
Columns("J:J").Select
Application.CutCopyMode = False
ActiveSheet.Range("$A$2:$M$1045658").RemoveDuplicates Columns:=10, Header:= _
xlYes
End Sub
Sub block22()
Sheets("block 22").Select
Columns("A:M").Select
Selection.ClearContents
Columns("A:A").Select
Sheets("DATA BASE").Select
ActiveSheet.showalldata
ActiveSheet.Range("$A$2:$AH$3061").AutoFilter Field:=31, Criteria1:="22"
Columns("A:AG").Select
Selection.Copy
Sheets("block 22").Select
Columns("A:A").Select
ActiveSheet.Paste
Columns("J:J").Select
Application.CutCopyMode = False
ActiveSheet.Range("$A$2:$M$1045658").RemoveDuplicates Columns:=10, Header:= _
xlYes
End Sub
Sub block23()
Sheets("block 23").Select
Columns("A:M").Select
Selection.ClearContents
Columns("A:A").Select
Sheets("DATA BASE").Select
ActiveSheet.showalldata
ActiveSheet.Range("$A$2:$AH$3061").AutoFilter Field:=31, Criteria1:="23"
Columns("A:AG").Select
Selection.Copy
Sheets("block 23").Select
Columns("A:A").Select
ActiveSheet.Paste
Columns("J:J").Select
Application.CutCopyMode = False
ActiveSheet.Range("$A$2:$M$1045658").RemoveDuplicates Columns:=10, Header:= _
xlYes
End Sub
Sub block24()
Sheets("block 24").Select
Columns("A:M").Select
Selection.ClearContents
Columns("A:A").Select
Sheets("DATA BASE").Select
ActiveSheet.showalldata
ActiveSheet.Range("$A$2:$AH$3061").AutoFilter Field:=31, Criteria1:="24"
Columns("A:AG").Select
Selection.Copy
Sheets("block 24").Select
Columns("A:A").Select
ActiveSheet.Paste
Columns("J:J").Select
Application.CutCopyMode = False
ActiveSheet.Range("$A$2:$M$1045658").RemoveDuplicates Columns:=10, Header:= _
xlYes
End Sub
Sub block25()
Sheets("block 25").Select
Columns("A:M").Select
Selection.ClearContents
Columns("A:A").Select
Sheets("DATA BASE").Select
ActiveSheet.showalldata
ActiveSheet.Range("$A$2:$AH$3061").AutoFilter Field:=31, Criteria1:="25"
Columns("A:AG").Select
Selection.Copy
Sheets("block 25").Select
Columns("A:A").Select
ActiveSheet.Paste
Columns("J:J").Select
Application.CutCopyMode = False
ActiveSheet.Range("$A$2:$M$1045658").RemoveDuplicates Columns:=10, Header:= _
xlYes
End Sub
Sub block26()
Sheets("block 26").Select
Columns("A:M").Select
Selection.ClearContents
Columns("A:A").Select
Sheets("DATA BASE").Select
ActiveSheet.showalldata
ActiveSheet.Range("$A$2:$AH$3061").AutoFilter Field:=31, Criteria1:="26"
Columns("A:AG").Select
Selection.Copy
Sheets("block 26").Select
Columns("A:A").Select
ActiveSheet.Paste
Columns("J:J").Select
Application.CutCopyMode = False
ActiveSheet.Range("$A$2:$M$1045658").RemoveDuplicates Columns:=10, Header:= _
xlYes
End Sub
Sub block27()
Sheets("block 27").Select
Columns("A:M").Select
Selection.ClearContents
Columns("A:A").Select
Sheets("DATA BASE").Select
ActiveSheet.showalldata
ActiveSheet.Range("$A$2:$AH$3061").AutoFilter Field:=31, Criteria1:="27"
Columns("A:AG").Select
Selection.Copy
Sheets("block 27").Select
Columns("A:A").Select
ActiveSheet.Paste
Columns("J:J").Select
Application.CutCopyMode = False
ActiveSheet.Range("$A$2:$M$1045658").RemoveDuplicates Columns:=10, Header:= _
xlYes
End Sub
Sub block31()
Sheets("block 31").Select
Columns("A:M").Select
Selection.ClearContents
Columns("A:A").Select
Sheets("DATA BASE").Select
ActiveSheet.showalldata
ActiveSheet.Range("$A$2:$AH$3061").AutoFilter Field:=31, Criteria1:="31"
Columns("A:AG").Select
Selection.Copy
Sheets("block 31").Select
Columns("A:A").Select
ActiveSheet.Paste
Columns("J:J").Select
Application.CutCopyMode = False
ActiveSheet.Range("$A$2:$M$1045658").RemoveDuplicates Columns:=10, Header:= _
xlYes
End Sub
Merci
Davy
22 juin 2017 à 07:01
code enregistrer sur excel2016
Excel 2007 sub block07 pas d'erreur!!
Pouvez-vous mettre votre fichier sans donnees confidentielles a dispo sur ce site
https://mon-partage.fr/
22 juin 2017 à 11:01
22 juin 2017 à 12:42
En effet, mais pourquoi une sur x, il y a erreur chez lui et pas chez moi ?????
22 juin 2017 à 13:11
Chez moi aussi ça fonctionne (sous condition que la feuille soit filtrée).
Il faudrait voir avec le fichier.
Il faudrait aussi supprimer les Select & Co