F
francki
Guest
Bonjour,
J'ai fais une macro pour mettre en forme un fichier.
Comment aplliquer la même macro automatiquement à d'autres fichiers ouverts (ou non) ?
Merci pour vos solutions
Voici ma macro toute bête :
Sub nettoyage()
'
' nettoyage Macro
' Macro enregistrée le 03/06/2003 par Francki
'
'
Rows("1:1").RowHeight = 29.25
Rows("1:1").Select
Range("I1").Activate
Selection.Delete Shift:=xlUp
Rows("2:2").Select
Range("I2").Activate
Selection.Delete Shift:=xlUp
ActiveWindow.LargeScroll ToRight:=-1
Columns("B:B").Select
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Columns("E:E").Select
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Range("B2").Select
ActiveCell.FormulaR1C1 = "=TEXT(RC[-1],""j/m/a"")"
Range("B2").Select
Selection.AutoFill Destination:=Range("B2:B1442")
Range("B2:B1442").Select
Selection.Copy
Range("C2").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Columns("A:B").Select
Range("B1").Activate
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
Range("A1").Select
ActiveCell.FormulaR1C1 = "Date"
With ActiveCell.Characters(Start:=1, Length:=4).Font
.Name = "Arial"
.FontStyle = "Normal"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Range("C2").Select
ActiveCell.FormulaR1C1 = "=TEXT(RC[-1],""hh:mm:ss"")"
Range("C2").Select
Selection.AutoFill Destination:=Range("C2:C1442")
Range("C2:C1442").Select
Selection.Copy
Range("D2").Select
Selection.PasteSpecial Paste:=xlFormats, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Columns("B:C").Select
Range("C1").Activate
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
Range("B1").Select
ActiveCell.FormulaR1C1 = "Heures"
With ActiveCell.Characters(Start:=1, Length:=6).Font
.Name = "Arial"
.FontStyle = "Normal"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Columns("N:N").Select
Selection.Insert Shift:=xlToRight
Range("N1").Select
ActiveCell.FormulaR1C1 = "Casier"
With ActiveCell.Characters(Start:=1, Length:=6).Font
.Name = "Arial"
.FontStyle = "Normal"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Range("N2").Select
End Sub
J'ai fais une macro pour mettre en forme un fichier.
Comment aplliquer la même macro automatiquement à d'autres fichiers ouverts (ou non) ?
Merci pour vos solutions
Voici ma macro toute bête :
Sub nettoyage()
'
' nettoyage Macro
' Macro enregistrée le 03/06/2003 par Francki
'
'
Rows("1:1").RowHeight = 29.25
Rows("1:1").Select
Range("I1").Activate
Selection.Delete Shift:=xlUp
Rows("2:2").Select
Range("I2").Activate
Selection.Delete Shift:=xlUp
ActiveWindow.LargeScroll ToRight:=-1
Columns("B:B").Select
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Columns("E:E").Select
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Range("B2").Select
ActiveCell.FormulaR1C1 = "=TEXT(RC[-1],""j/m/a"")"
Range("B2").Select
Selection.AutoFill Destination:=Range("B2:B1442")
Range("B2:B1442").Select
Selection.Copy
Range("C2").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Columns("A:B").Select
Range("B1").Activate
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
Range("A1").Select
ActiveCell.FormulaR1C1 = "Date"
With ActiveCell.Characters(Start:=1, Length:=4).Font
.Name = "Arial"
.FontStyle = "Normal"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Range("C2").Select
ActiveCell.FormulaR1C1 = "=TEXT(RC[-1],""hh:mm:ss"")"
Range("C2").Select
Selection.AutoFill Destination:=Range("C2:C1442")
Range("C2:C1442").Select
Selection.Copy
Range("D2").Select
Selection.PasteSpecial Paste:=xlFormats, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Columns("B:C").Select
Range("C1").Activate
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
Range("B1").Select
ActiveCell.FormulaR1C1 = "Heures"
With ActiveCell.Characters(Start:=1, Length:=6).Font
.Name = "Arial"
.FontStyle = "Normal"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Columns("N:N").Select
Selection.Insert Shift:=xlToRight
Range("N1").Select
ActiveCell.FormulaR1C1 = "Casier"
With ActiveCell.Characters(Start:=1, Length:=6).Font
.Name = "Arial"
.FontStyle = "Normal"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Range("N2").Select
End Sub