Excel - macro mise en forme
Fermé
stephy13
Messages postés
75
Date d'inscription
lundi 16 novembre 2009
Statut
Membre
Dernière intervention
10 décembre 2013
-
19 avril 2010 à 11:48
stephy13 Messages postés 75 Date d'inscription lundi 16 novembre 2009 Statut Membre Dernière intervention 10 décembre 2013 - 20 avril 2010 à 16:28
stephy13 Messages postés 75 Date d'inscription lundi 16 novembre 2009 Statut Membre Dernière intervention 10 décembre 2013 - 20 avril 2010 à 16:28
A voir également:
- Excel - macro mise en forme
- Mise en forme conditionnelle excel - Guide
- Telecharger macro convertir chiffre en lettre excel - Télécharger - Tableur
- Mise en forme tableau word - Guide
- Liste déroulante excel - Guide
- Mise a jour chrome - Accueil - Applications & Logiciels
5 réponses
funbreizhou
Messages postés
76
Date d'inscription
samedi 10 octobre 2009
Statut
Membre
Dernière intervention
3 novembre 2011
11
19 avril 2010 à 12:19
19 avril 2010 à 12:19
bonjour,
Ca se fait facilement avec les macros :
Sub A()
If Range("E1") = 1 Then
Range("E2").Select
ActiveCell.FormulaR1C1 = "A"
Range("E2").Select
With selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Range("E1").Select
ActiveWindow.SmallScroll Down:=15
End If
End Sub
ça par exemple ca serait pour avoir un A rouge et en gras dans la cellule E2 si E1 = 1.
Essaye de voir si t'arrives déjà à coller cette macro là où il faut
Ca se fait facilement avec les macros :
Sub A()
If Range("E1") = 1 Then
Range("E2").Select
ActiveCell.FormulaR1C1 = "A"
Range("E2").Select
With selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Range("E1").Select
ActiveWindow.SmallScroll Down:=15
End If
End Sub
ça par exemple ca serait pour avoir un A rouge et en gras dans la cellule E2 si E1 = 1.
Essaye de voir si t'arrives déjà à coller cette macro là où il faut
stephy13
Messages postés
75
Date d'inscription
lundi 16 novembre 2009
Statut
Membre
Dernière intervention
10 décembre 2013
11
19 avril 2010 à 12:50
19 avril 2010 à 12:50
merci pour ta réponse, par contre je pense l'avoir collé au bon endroit (développeur --> enregistrer une macro (nom macro : A) --> développeur --> macro --> modifié --> ctrl + V) par contre je ne sais pas comment l'activer car là pour le moment ça ne marche pas. Merci
funbreizhou
Messages postés
76
Date d'inscription
samedi 10 octobre 2009
Statut
Membre
Dernière intervention
3 novembre 2011
11
Modifié par funbreizhou le 19/04/2010 à 13:30
Modifié par funbreizhou le 19/04/2010 à 13:30
tu fais ALT + F11, tu cliques sur "feuille1" en haut à gauche et tu colles tout. Après c'est à toi d'adapter les noms de cellules. j'ai essayé de suivre ton modèle mais j'ai pu me tromper.
funbreizhou
Messages postés
76
Date d'inscription
samedi 10 octobre 2009
Statut
Membre
Dernière intervention
3 novembre 2011
11
19 avril 2010 à 13:48
19 avril 2010 à 13:48
Sub format()
If Range("E1") = 1 Then
Range("E2").Select
selection.Font.Bold = True
With selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
selection.Font.ColorIndex = 3
selection.Font.Underline = xlUnderlineStyleSingle
selection.Font.Underline = xlUnderlineStyleNone
ActiveCell.FormulaR1C1 = "A"
Range("E3").Select
Else: GoTo suite
End If
suite:
If Range("E1") = 2 Then
Range("E2").Select
selection.Font.Bold = True
With selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
selection.Font.ColorIndex = 43
selection.Font.Underline = xlUnderlineStyleSingle
ActiveCell.FormulaR1C1 = "B"
Range("E3").Select
Else: GoTo suite2
End If
suite2:
If Range("E1") = 3 Then
Range("E2").Select
selection.Font.Bold = True
With selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
selection.Font.ColorIndex = 55
ActiveCell.FormulaR1C1 = "C"
Range("E2").Select
selection.Font.Underline = xlUnderlineStyleSingle
selection.Font.Underline = xlUnderlineStyleNone
Else: GoTo suite3
End If
suite3:
If Range("E1") = 4 Then
Range("E2").Select
selection.Font.Bold = True
With selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
selection.Font.ColorIndex = 45
selection.Font.Underline = xlUnderlineStyleSingle
ActiveCell.FormulaR1C1 = "D"
Range("E3").Select
Else
End If
End Sub
Voilà le code complet pour ce que t'as demandé.
If Range("E1") = 1 Then
Range("E2").Select
selection.Font.Bold = True
With selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
selection.Font.ColorIndex = 3
selection.Font.Underline = xlUnderlineStyleSingle
selection.Font.Underline = xlUnderlineStyleNone
ActiveCell.FormulaR1C1 = "A"
Range("E3").Select
Else: GoTo suite
End If
suite:
If Range("E1") = 2 Then
Range("E2").Select
selection.Font.Bold = True
With selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
selection.Font.ColorIndex = 43
selection.Font.Underline = xlUnderlineStyleSingle
ActiveCell.FormulaR1C1 = "B"
Range("E3").Select
Else: GoTo suite2
End If
suite2:
If Range("E1") = 3 Then
Range("E2").Select
selection.Font.Bold = True
With selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
selection.Font.ColorIndex = 55
ActiveCell.FormulaR1C1 = "C"
Range("E2").Select
selection.Font.Underline = xlUnderlineStyleSingle
selection.Font.Underline = xlUnderlineStyleNone
Else: GoTo suite3
End If
suite3:
If Range("E1") = 4 Then
Range("E2").Select
selection.Font.Bold = True
With selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
selection.Font.ColorIndex = 45
selection.Font.Underline = xlUnderlineStyleSingle
ActiveCell.FormulaR1C1 = "D"
Range("E3").Select
Else
End If
End Sub
Voilà le code complet pour ce que t'as demandé.
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question
stephy13
Messages postés
75
Date d'inscription
lundi 16 novembre 2009
Statut
Membre
Dernière intervention
10 décembre 2013
11
20 avril 2010 à 16:28
20 avril 2010 à 16:28
Merci bcp funbreizhou :-)