Erreur 1004
tetro14
Messages postés
8
Date d'inscription
Statut
Membre
Dernière intervention
-
ThauTheme Messages postés 1442 Date d'inscription Statut Membre Dernière intervention -
ThauTheme Messages postés 1442 Date d'inscription Statut Membre Dernière intervention -
Bonjour, je tente de faire un copier-coller sur une plage X, mon problème est que je veux qu'un bouton active ce copier-coller sur plusieurs page différente. voici mon code :
Sub Formule()
Dim DernLigne As Long
Dim lastcolumn As Long
With Sheets("Liste")
.Cells(5, 3) = Sheets("Liste").Cells(1, 2).Formula
DernLigne = Range("A" & Rows.Count).End(xlUp).Row
Sheets("Liste").Cells(5, 3).AutoFill Destination:=Range("C5", "C" & DernLigne)
Sheets("Liste").Cells(5, 5) = Sheets("Liste").Cells(2, 2).Formula
Sheets("Liste").Cells(5, 5).AutoFill Destination:=Range("E5", "E" & DernLigne)
End With
With Sheets("Actifs")
lastcolumn = Cells(5, Columns.Count).End(xlToLeft).Column
Sheets("actifs").Range("D7").AutoFill Destination:=Range(Sheets("actifs").Cells(7, 4), Sheets("actifs").Cells(7, lastcolumn))
End With
With Sheets("Geo")
lastcolumn = Cells(5, Columns.Count).End(xlToLeft).Column
.Cells(7, 4).AutoFill Destination:=Range(Cells(7, 4), Cells(7, lastcolumn))
End With
End Sub
La section en italique est où apparaît l'erreur
Sub Formule()
Dim DernLigne As Long
Dim lastcolumn As Long
With Sheets("Liste")
.Cells(5, 3) = Sheets("Liste").Cells(1, 2).Formula
DernLigne = Range("A" & Rows.Count).End(xlUp).Row
Sheets("Liste").Cells(5, 3).AutoFill Destination:=Range("C5", "C" & DernLigne)
Sheets("Liste").Cells(5, 5) = Sheets("Liste").Cells(2, 2).Formula
Sheets("Liste").Cells(5, 5).AutoFill Destination:=Range("E5", "E" & DernLigne)
End With
With Sheets("Actifs")
lastcolumn = Cells(5, Columns.Count).End(xlToLeft).Column
Sheets("actifs").Range("D7").AutoFill Destination:=Range(Sheets("actifs").Cells(7, 4), Sheets("actifs").Cells(7, lastcolumn))
End With
With Sheets("Geo")
lastcolumn = Cells(5, Columns.Count).End(xlToLeft).Column
.Cells(7, 4).AutoFill Destination:=Range(Cells(7, 4), Cells(7, lastcolumn))
End With
End Sub
La section en italique est où apparaît l'erreur
A voir également:
- Erreur 1004
- Erreur 0x80070643 - Accueil - Windows
- Erreur 0x80070643 Windows 10 : comment résoudre le problème de la mise à jour KB5001716 - Accueil - Windows
- J'aime par erreur facebook notification - Forum Facebook
- Code erreur f3500-31 ✓ - Forum Bbox Bouygues
- Java code erreur 1603 ✓ - Forum Windows
1 réponse
Bonjour Tetro, bonjour el forum,
Tu oublies souvent le point faisant référence au With devant certains Range ou Cells. Ton code modifié mais non testé :
Tu oublies souvent le point faisant référence au With devant certains Range ou Cells. Ton code modifié mais non testé :
Sub Formule() Dim DernLigne As Long Dim lastcolumn As Integer With Sheets("Liste") .Cells(5, 3).Formula = .Cells(1, 2).Formula DernLigne = .Range("A" & Rows.Count).End(xlUp).Row .Cells(5, 3).AutoFill Destination:=.Range("C5:C" & DernLigne) .Cells(5, 5).Formula = .Cells(2, 2).Formula .Cells(5, 5).AutoFill Destination:=.Range("E5:E" & DernLigne) End With With Sheets("Actifs") lastcolumn = .Cells(5, Columns.Count).End(xlToLeft).Column .Range("D7").AutoFill Destination:=.Range(.Cells(7, 4), .Cells(7, lastcolumn)) End With With Sheets("Geo") lastcolumn = .Cells(5, Columns.Count).End(xlToLeft).Column .Cells(7, 4).AutoFill Destination:=.Range(.Cells(7, 4), .Cells(7, lastcolumn)) End With End Sub