McQMom
asked on
Excel vba font color keeps shoeing white, instead of gray
Hi! I have code that changes the font in a column of a pivot table to a dark gray, but when I run the macro, its turns the font white. I don't know if it has "View Gridlines" turned off (which are the same dark gray color I'm trying to turn the font). Can anyone help? I'm going crazy. FontColorExample.docx
Sub Fixfont4()
'
' Fixfont4 Macro
'
'
Range("E4").Select
ActiveSheet.PivotTables("PivotTable1").PivotSelect "Formula1", xlDataAndLabel, _
True
Selection.Font.Italic = False
With Selection.Font
.ColorIndex = xlAutomatic
.TintAndShade = 0
End With
ActiveSheet.PivotTables("PivotTable1").PivotSelect "Forecast", xlDataAndLabel, _
True
With Selection.Font
.ThemeColor = xlThemeColorDark1
.TintAndShade = -0.499984740745262
End With
Selection.Font.Bold = True
Selection.Font.Italic = True
End Sub
ASKER
Then I get all my pivot columns in regular font (Including my forecast) and my Total Shipped & Open column (A calculated item column) in bold.
Looks like it might be an anomaly in the new Excel, based on the color themes.
Restore the original code you had and add something like this just before "Selection.Font.Bold = True"
Restore the original code you had and add something like this just before "Selection.Font.Bold = True"
ActiveSheet.PivotTables("PivotTable1").PivotSelect "Values", xlDataAndLabel, True
Range("F10:I12").Select
With Selection.Font
'.ThemeColor = xlThemeColorDark1
'.TintAndShade = -0.499984740745262
.Color = &H808080
.TintAndShade = 0
End With
ASKER
Still showing up as white. Dang - it's driving me crazy!
Post your code again so I can test it on my end.
I saw the white appear but the above code fixed it for me in v2010.
I saw the white appear but the above code fixed it for me in v2010.
ASKER
I seem to be able to get it in a dark blue now, but still not in the dark gray. It still turns white...
ActiveSheet.PivotTables("PivotTable1").PivotSelect "Forecast", xlDataAndLabel, _
True
With Selection.Font
.ThemeColor = xlThemeColorAccent1
.TintAndShade = -0.249977111117893
End With
Selection.Font.Bold = True
Selection.Font.Italic = True
ActiveSheet.PivotTables("PivotTable1").PivotSelect "Formula2", xlDataAndLabel, _
True
Selection.Font.Italic = True
Selection.Font.Bold = True
Looks like you didn't understand that I wanted you to add my code into yours, like this:
However, I'm not sure that "Values" is the correct piece so you may need to adjust that to another Pivot setting.
Sub Fixfont4()
'
' Fixfont4 Macro
'
'
Range("E4").Select
ActiveSheet.PivotTables("PivotTable1").PivotSelect "Formula1", xlDataAndLabel, _
True
Selection.Font.Italic = False
With Selection.Font
.ColorIndex = xlAutomatic
.TintAndShade = 0
End With
ActiveSheet.PivotTables("PivotTable1").PivotSelect "Forecast", xlDataAndLabel, _
True
With Selection.Font
.ThemeColor = xlThemeColorDark1
.TintAndShade = -0.499984740745262
End With
ActiveSheet.PivotTables("PivotTable1").PivotSelect "Values", xlDataAndLabel, True
Range("F10:I12").Select
With Selection.Font
'.ThemeColor = xlThemeColorDark1
'.TintAndShade = -0.499984740745262
.Color = &H808080
.TintAndShade = 0
End With
Selection.Font.Bold = True
Selection.Font.Italic = True
End Sub
However, I'm not sure that "Values" is the correct piece so you may need to adjust that to another Pivot setting.
ASKER
Still all just white, I think I'm just going to leave it blue - :( White-font-example.docx
Any chance of sending the workbook?
At least then I can see if the same problem happens on my end.
At least then I can see if the same problem happens on my end.
ASKER
I'll try and mutate the numbers enough to send it to you.
ASKER
Here it is. Font-Color.xlsm
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Perfect! Thank you so much for your perseverance. :)
ActiveSheet.PivotTables("P
True
With Selection.Font
.ThemeColor = xlThemeColorDark1
.TintAndShade = -0.499984740745262
End With
If you take out those lines, what happens?
' ActiveSheet.PivotTables("P
True
' With Selection.Font
' .ThemeColor = xlThemeColorDark1
' .TintAndShade = -0.499984740745262
' End With