Rapport de message :*
 

Re: Différentes police dans une même cellule

Titre du sujet : Re: Différentes police dans une même cellule
par francois1913 le 25/04/2018 10:11:01

Salut,

 

Alors j'ai magouillé mes formules pour que celles-ci correspondent à l'infrastructure que tu m'avais fait sur le premier code. Je l'ai ensuite adapté pour mes autres tableaux et ça marche nickel...

J'ai aussi passé chez un pote informaticien qui m'a expliqué deux trois trucs et m'a montré l'élément ESSENTIEL si veux comprendre où est ton erreur : la fenêtre VARIABLE LOCAL !

L'infrastructure (espace etc) et la rigueur sont effectivement primordial dans ces tableaux

 

Maintenant tous est OK... Merci de ton dévouement ;)

 

Bonne journée à tous...

 

PS: voici mon code si cela peut intéresser quelqu'un....

 

 

Option Explicit

Public val_cel As Boolean

 

Private Sub Worksheet_Change(ByVal Target As Range)
Application.ScreenUpdating = False
If val_cel = True Then val_cel = False: Exit Sub
lance
Application.ScreenUpdating = True
End Sub

 

Sub lance()
Dim tablo
Dim tablo_01
Dim tablo_02
Dim tablo_03

 

Dim t0 As String, t1 As String, t2 As String, t3 As String, t4 As String

 

' dechet bleu
' rempl vert
' sav rouge
' solde jaune
' violet total

 

'Coût NC par semaine

 

If IsError(Range("AD153")) Then val_cel = True: Range("AD153").Value = "": Exit Sub
tablo = Split(Range("AD153").Value, ":")
tablo_01 = Split(Mid(Range("AD153"), Len(tablo(0)) + 3), "       ")
t0 = tablo_01(0)    ' rempl
tablo_02 = Split(tablo_01(1), "  ")
t1 = tablo_02(0)    ' dechet
t2 = tablo_02(1)    ' soldes
tablo_03 = Split(tablo_01(2), "  ")
t3 = tablo_03(0)    ' sav
t4 = tablo_03(1)    ' total

 

val_cel = True

 

ActiveSheet.Shapes("Rectangle 17").Select   ' rectangle où se situera les couleurs
Selection.ShapeRange.TextFrame2.TextRange.Font.Size = 10
With Selection
    .Characters.Text = Range("AD153").Value   ' cellule où est située la formule
    .Characters.Font.ColorIndex = 0 ' titre
    .Characters(Start:=Len(tablo(0)), Length:=Len(t0) + 3).Font.ColorIndex = 10  ' rempl
    .Characters(Start:=Len(tablo(0)) + Len(t0) + 10, Length:=Len(t1)).Font.ColorIndex = 41 ' dechet
    .Characters(Start:=Len(tablo(0)) + Len(t0) + 10 + Len(t1) + 2, Length:=Len(t2)).Font.ColorIndex = 44 ' soldes
    .Characters(Start:=Len(tablo(0)) + Len(t0) + 10 + Len(t1) + 2 + Len(t2) + 7, Length:=Len(t3)).Font.ColorIndex = 3 ' sav
    .Characters(Start:=Len(tablo(0)) + Len(t0) + 10 + Len(t1) + 2 + Len(t2) + 7 + Len(t3) + 2, Length:=Len(t4)).Font.ColorIndex = 7 ' total


End With

 

'Nbr de composant par semaine

 

If IsError(Range("AD106")) Then val_cel = True: Range("AD106").Value = "": Exit Sub
tablo = Split(Range("AD106").Value, ":")
tablo_01 = Split(Mid(Range("AD106"), Len(tablo(0)) + 3), "       ")
t0 = tablo_01(0)    ' rempl
tablo_02 = Split(tablo_01(1), "  ")
t1 = tablo_02(0)    ' dechet
t2 = tablo_02(1)    ' soldes
tablo_03 = Split(tablo_01(2), "  ")
t3 = tablo_03(0)    ' sav
t4 = tablo_03(1)    ' total

 

val_cel = True

 

ActiveSheet.Shapes("Rectangle 13").Select   ' rectangle où se situera les couleurs
Selection.ShapeRange.TextFrame2.TextRange.Font.Size = 10
With Selection
    .Characters.Text = Range("AD106").Value   ' cellule où est située la formule
    .Characters.Font.ColorIndex = 0 ' titre
    .Characters(Start:=Len(tablo(0)), Length:=Len(t0) + 3).Font.ColorIndex = 10  ' rempl
    .Characters(Start:=Len(tablo(0)) + Len(t0) + 10, Length:=Len(t1)).Font.ColorIndex = 41 ' dechet
    .Characters(Start:=Len(tablo(0)) + Len(t0) + 10 + Len(t1) + 2, Length:=Len(t2)).Font.ColorIndex = 44 ' soldes
    .Characters(Start:=Len(tablo(0)) + Len(t0) + 10 + Len(t1) + 2 + Len(t2) + 7, Length:=Len(t3)).Font.ColorIndex = 3 ' sav
    .Characters(Start:=Len(tablo(0)) + Len(t0) + 10 + Len(t1) + 2 + Len(t2) + 7 + Len(t3) + 2, Length:=Len(t4)).Font.ColorIndex = 7 ' total


End With

 

'Pourcentage de remplacement

 

If IsError(Range("AD99")) Then val_cel = True: Range("AD99").Value = "": Exit Sub
tablo = Split(Range("AD99").Value, ":")
tablo_01 = Split(Mid(Range("AD99"), Len(tablo(0)) + 3), "       ")
t0 = tablo_01(0)    ' rempl
tablo_02 = Split(tablo_01(1), "  ")
t1 = tablo_02(0)    ' dechet
t2 = tablo_02(1)    ' total

 

val_cel = True

 

ActiveSheet.Shapes("Rectangle 8").Select   ' rectangle où se situera les couleurs
Selection.ShapeRange.TextFrame2.TextRange.Font.Size = 10
With Selection
    .Characters.Text = Range("AD99").Value   ' cellule où est située la formule
    .Characters.Font.ColorIndex = 0 ' titre
    .Characters(Start:=Len(tablo(0)), Length:=Len(t0) + 3).Font.ColorIndex = 10  ' rempl
    .Characters(Start:=Len(tablo(0)) + Len(t0) + 10, Length:=Len(t1)).Font.ColorIndex = 41 ' dechet
    .Characters(Start:=Len(tablo(0)) + Len(t0) + 10 + Len(t1) + 2, Length:=Len(t2)).Font.ColorIndex = 7 ' total


End With

 

val_cel = False

 

Range("N10").Select
End Sub