Bonjour le Forum
J'ai écris un code qui me permet de copier et d'insérer dans un onglet des données (Merci James007)
Je cherche à automatiser ce code en le lançant une fois par semaine mais ça ne marche pas
Excel sera toujours ouvert
Dans le ThisWorkBook
Private Sub Workbook_Open()
Application.OnTime TimeValue("09:33:00"), "Sauve"
End Sub
Dans un module
Sub Sauve()
'Macro enregitrée par jfo le 21/04/2015
If Weekday(Date) = vbSaturday Then
Dim DLig As Integer
With Sheets("Compteur") 'Sélectionne la feuille Compteur
DLig = .Range("A" & Rows.Count).End(xlUp).Row + 1 ' Positionne sur la bonne cellule
.Rows(DLig).Insert
'Recopie des formules
.Cells(DLig, "A") = Cells(DLig - 1, "A").Value
.Cells(DLig, "B").FormulaR1C1 = Cells(DLig - 1, "B").FormulaR1C1
.Cells(DLig, "D").FormulaR1C1 = Cells(DLig - 1, "D").FormulaR1C1
.Cells(DLig, "E").FormulaR1C1 = Cells(DLig - 1, "E").FormulaR1C1
.Cells(DLig, "G").FormulaR1C1 = Cells(DLig - 1, "G").FormulaR1C1
.Cells(DLig, "H").FormulaR1C1 = Cells(DLig - 1, "H").FormulaR1C1
.Cells(DLig, "I").FormulaR1C1 = Cells(DLig - 1, "I").FormulaR1C1
.Cells(DLig, "J").FormulaR1C1 = Cells(DLig - 1, "J").FormulaR1C1
'Récupération des données de la feuille "Récap Prises"
Sheets("Récap Prises").Cells(24, 8).Copy
Sheets("Compteur").Cells(65535, 3).End(xlUp)(2).PasteSpecial xlPasteValues
Sheets("Récap Prises").Cells(37, 8).Copy
Sheets("Compteur").Cells(65535, 6).End(xlUp)(2).PasteSpecial xlPasteValues
Application.CutCopyMode = False
End With
End If
Application.Wait "09:33:01"
Application.OnTime TimeValue("09:33:00"), "Sauve"
End Sub
Je joint le fichier
D'avance merci pour votre aide et votre disponibilité