Bonjour,
J'execute une macro toutes les secondes, mais quand j'ouvre un autre fichier ma macro s'arrete.
Merci d'avance pour vos lumières
	
	
	
	
	
		
	
		
			
		
		
	
				
			J'execute une macro toutes les secondes, mais quand j'ouvre un autre fichier ma macro s'arrete.
Merci d'avance pour vos lumières
		VB:
	
	
	Option Explicit
    Dim RunTimer  As Date
Sub CopyAndPaste()
    RunTimer = Now + TimeValue("00:00:01")
    Application.OnTime RunTimer, "CopyAndPaste"
    '
    ' Copy And Paste Macro
    '
    Sheets("Data").Range("A3:BA3").Select
    Selection.Insert Shift:=xlDown
    Sheets("Data").Range("A2:BA2").Copy
    Sheets("Data").Range("A3").PasteSpecial xlPasteValuesAndNumberFormats
End Sub
Sub StopTheMacro()
    Application.OnTime RunTimer, "CopyAndPaste", , False
    MsgBox "The macro stopped"
End Sub
Sub StartTheMacro()
    Application.OnTime RunTimer, "CopyAndPaste", , True
    MsgBox "The macro started"
End Sub