C
chouill
Guest
bonjour,
je travail actuellement sur un tableau de valeurs, celles ci son rentrées dans des cellules dont le format est spécifié par une macro que voici :
Sub test()
Range("A1:E1").Select
ActiveCell.FormulaR1C1 = "1 Pré conditionement :"
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = True
End With
Range("O1😛1").Select
ActiveCell.FormulaR1C1 = "Réaliser le :"
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = True
End With
Range("Q1:R1").Select
ActiveCell.FormulaR1C1 = "6/21/2009"
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = True
End With
...
comme on peut le constater la ligne de code en rouge est redondante j'aimerais la remplacer par une variable du type "
Dim FormatCal as ....
FormatCel = Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = True
End With
merci de votre aide
je travail actuellement sur un tableau de valeurs, celles ci son rentrées dans des cellules dont le format est spécifié par une macro que voici :
Sub test()
Range("A1:E1").Select
ActiveCell.FormulaR1C1 = "1 Pré conditionement :"
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = True
End With
Range("O1😛1").Select
ActiveCell.FormulaR1C1 = "Réaliser le :"
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = True
End With
Range("Q1:R1").Select
ActiveCell.FormulaR1C1 = "6/21/2009"
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = True
End With
...
comme on peut le constater la ligne de code en rouge est redondante j'aimerais la remplacer par une variable du type "
Dim FormatCal as ....
FormatCel = Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = True
End With
merci de votre aide