conversion d'un code vba 2007 à 2003

  • Initiateur de la discussion Initiateur de la discussion zizoufan
  • Date de début Date de début

Boostez vos compétences Excel avec notre communauté !

Rejoignez Excel Downloads, le rendez-vous des passionnés où l'entraide fait la force. Apprenez, échangez, progressez – et tout ça gratuitement ! 👉 Inscrivez-vous maintenant !

zizoufan

XLDnaute Occasionnel
Bonjour,

J'ai fait ce code à des fins d'habillage d'une cellule en vba sous 2007 :

Range("A1:E1").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
.Merge
End With
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
'.LineStyle = xlContinuous
.ColorIndex = 0
'.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
'.LineStyle = xlContinuous
.ColorIndex = 0
'.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
'.LineStyle = xlContinuous
.ColorIndex = 0
'.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
'.LineStyle = xlContinuous
.ColorIndex = 0
'.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = 0
'.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideHorizontal)
'.LineStyle = xlContinuous
.ColorIndex = 0
'.TintAndShade = 0
.Weight = xlThin
End With
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("A1:E1").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 65535
'.TintAndShade = 0
.PatternTintAndShade = 0
End With
Cells(1, 1).Font.Bold = True
Cells(2, 1) = "Chemin de l'enregistrement": Cells(2, 2) = "Nom du fichier": Cells(2, 3) = "Crée le "
Cells(2, 4) = "Modifié le ": Cells(2, 5) = "CEA"
Range("A2:E2").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark1
'.TintAndShade = -4.99893185216834E-02
.PatternTintAndShade = 0
End With


une fois sur 2003, je n'ai pas pu faire marcher le code surtout pour .tintandshade, .colorindex ??

Merci de votre aide.
 
Re : conversion d'un code vba 2007 à 2003

Bonsoir à tous

zizoufan:
Voici une version allégée de ton code.
Code vba:
Sub Macro1()
With Range("A1:E1")
.HorizontalAlignment = xlCenter: .VerticalAlignment = xlBottom
.Borders.LineStyle = 1: .Borders.Weight = xlThin: .Borders.ColorIndex = 0
End With
Cells(1, 1).Font.Bold = True
Cells(2, 1) = "Chemin de l'enregistrement": Cells(2, 2) = "Nom du fichier": Cells(2, 3) = "Crée le "
Cells(2, 4) = "Modifié le ": Cells(2, 5) = "CEA"
End Sub



Le résultat est-il le même?
(sauf évidemment pour par cette dernière partie que je n'ai pas traité, cf ci-dessous)
Range("A2:E2").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark1
'.TintAndShade = -4.99893185216834E-02
.PatternTintAndShade = 0
End With
 
- Navigue sans publicité
- Accède à Cléa, notre assistante IA experte Excel... et pas que...
- Profite de fonctionnalités exclusives
Ton soutien permet à Excel Downloads de rester 100% gratuit et de continuer à rassembler les passionnés d'Excel.
Je deviens Supporter XLD

Discussions similaires

  • Question Question
Microsoft 365 worksheet_change
Réponses
29
Affichages
479
Réponses
11
Affichages
780
Réponses
8
Affichages
1 K
Retour