Demande aide pour modification format de texte et nombre (mise en forme)
Bonjour à tous,
Je souhaite créer une feuille excel qui fait le lien entre un tableau de donnée et un powerpoint avec des slides bien définies. (Dans les slides sont placés plusieurs cases avec les données numériques).
Dans chaque cellule de la feuille excel, plusieurs données sont transferés pour créer la présentation (texte et variable).
Pour le moment j'ai réussi à créer le transfert des informations comme je le souhaitais, avec les bonnes valeurs et décimales, cependant 2 problématiques se présentent à moi :
- Les valeurs numériques (variable en currency) ne prennent pas une mise en forme avec le séparateur de millier, lors d'une mise en forme manuelle en séparateur, la mise en forme est modifiée et il n'y a aucune séparation.
- Je n'ai pas réussi à mettre en forme le texte des cellules (mise en gras, police et couleur), donc malheureusement pour le momennt j'ai utilisé l'enregisteur de macro.
Mais dès que les variables se modifient, avec le / ActiveCell.Characters(Start:=93, Length:=40).Font" / la mise en forme s'en voit décalé sur le texte suivant ou précédent.
La suite de ma réflection a été de transformer mon texte en variable string puis de mettre en forme la cellule directement et non par variable, cependant cela n'a pas fonctionné.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
|
Worksheets("Tableaux de bord").Activate
Dim variable_281 As Currency 'variable_1
variable_281 = Range("U4").Value
variable_281 = Format(variable_281, "currency")
Dim variable_282 As Currency 'variable_2
variable_282 = Range("U5").Value
variable_282 = Format(variable_282, "currency")
Dim variable_283 As Currency 'variable_3
variable_283 = Range("U6").Value
variable_283 = Format(variable_283, "currency")
Dim variable_284 As Currency 'variable_4
variable_284 = Range("U7").Value
variable_284 = Format(variable_284, "currency")
Dim variable_285 As Currency 'variable_5
variable_285 = Range("U8").Value
variable_285 = Format(variable_285, "currency")
Dim variable_286 As Currency 'variable_6
variable_286 = Range("U9").Value
variable_286 = Format(variable_286, "currency")
Dim variable_287 As Currency 'variable_7
variable_287 = Range("U10").Value
variable_287 = Format(variable_287, "currency")
Dim variable_288 As Currency 'variable_8
variable_288 = Range("U11").Value
variable_288 = Format(variable_288, "currency")
Dim variable_289 As Currency 'variable_9
variable_289 = Range("U12").Value
variable_289 = Format(variable_289, "currency")
Dim variable_290 As Currency 'variable_10
variable_290 = Range("U13").Value
variable_290 = Format(variable_290, "currency")
Dim variable_291 As Currency 'variable_11
variable_291 = Range("U14").Value
variable_291 = Format(variable_291, "currency")
Dim variable_292 As Currency 'variable_12
variable_292 = Range("U15").Value
variable_292 = Format(variable_292, "currency")
Dim variable_293 As String 'variable_13
variable_293 = Range("U16").Value
Dim variable_294 As String 'variable_14
variable_294 = Range("U17").Value
Dim variable_295 As String 'variable_15
variable_295 = Range("U18").Value
Worksheets("Box à mettre à jour").Activate
Range("A73").Value = "Total Asset Und C EUR : " & variable_285 & " (" & variable_286 & " % in global)" & Chr(10) & "R Asset Und C EUR : " & variable_287 & " (" & variable_288 & "% in global)" & Chr(10) & "Fees In EUR : " & variable_289 & " (" & variable_290 & "% in global)" & Chr(10) & "Marge EUR : " & variable_291 & " (" & variable_292 & " % in global)"
Range("A73").Select
With ActiveCell.Characters(Start:=1, Length:=310).Font
.Name = "Candara"
.FontStyle = "Normal"
.Size = 7
.ThemeColor = xlThemeColorAccent1
.ThemeFont = xlThemeFontMinor
.Bold = True
End With
With ActiveCell.Characters(Start:=32, Length:=201).Font
.Name = "Candara"
.FontStyle = "Normal"
.Size = 7
.ThemeColor = xlThemeColorLight1
.ThemeFont = xlThemeFontMinor
End With
With ActiveCell.Characters(Start:=67, Length:=307).Font
.Name = "Candara"
.FontStyle = "Normal"
.Size = 7
.ThemeColor = xlThemeColorAccent1
.ThemeFont = xlThemeFontMinor
.Bold = True
End With
With ActiveCell.Characters(Start:=105, Length:=3100).Font
.Name = "Candara"
.FontStyle = "Normal"
.Size = 7
.ThemeColor = xlThemeColorLight1
.ThemeFont = xlThemeFontMinor
End With
With ActiveCell.Characters(Start:=135, Length:=1300).Font
.Name = "Candara"
.FontStyle = "Normal"
.Size = 7
.ThemeColor = xlThemeColorAccent1
.ThemeFont = xlThemeFontMinor
.Bold = True
End With
With ActiveCell.Characters(Start:=148, Length:=2400).Font
.Name = "Candara"
.FontStyle = "Normal"
.Size = 7
.ThemeColor = xlThemeColorLight1
.ThemeFont = xlThemeFontMinor
End With
With ActiveCell.Characters(Start:=171, Length:=150).Font
.Name = "Candara"
.FontStyle = "Normal"
.Size = 7
.ThemeColor = xlThemeColorAccent1
.ThemeFont = xlThemeFontMinor
.Bold = True
End With
With ActiveCell.Characters(Start:=188, Length:=250).Font
.Name = "Candara"
.FontStyle = "Normal"
.Size = 7
.ThemeColor = xlThemeColorLight1
.ThemeFont = xlThemeFontMinor
End With |
Voici globalement la macro avant la mise en place du text en varaible.