+ Reply to Thread
Results 1 to 10 of 10

Macro changing font color to white instead of gray

  1. #1
    Registered User
    Join Date
    09-03-2013
    Location
    Elgin, IL
    MS-Off Ver
    Excel 2010
    Posts
    90

    Macro changing font color to white instead of gray

    Hello excel forum. I have what I think should be a fairly straightforward Marco, but when I run it, it changes the font color in the referenced cells white instead of dark gray. I deleted the macro I had recorded twice and recorded two additional times and each time I encounter the same issue.

    Why doesn't the macro change the font color to dark gray as when I record it?

    Attached is the sample worksheet with 2 macros. The "HIDE" button runs the macro that is operating correctly, which hides rows 65 and 66, and changes the font type in rows 63 and 645 from dark gray, unbolded, 10 point font to black, bold, 12 point font.

    The Unhide button is supposed to run the macro that reverses what the first Macro did, so I've recorded it to unbold the data in rows 63 and 64, change the font size back to 10 and color from black to dark gray, and unhide rows 65 & 66. The macro does everything correctly, except it changes the font to white instead of dark gray.

    Can anyone guide me to the solution to my problem?

    Be Well,
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    08-09-2012
    Location
    British Columbia
    MS-Off Ver
    Excel 2010
    Posts
    189

    Re: Macro changing font color to white instead of gray

    Can anyone guide me to the solution to my problem?
    Maybe, but it would be much easier if we could see your macros.
    That's an .xlsx file you've posted.

  3. #3
    Registered User
    Join Date
    09-03-2013
    Location
    Elgin, IL
    MS-Off Ver
    Excel 2010
    Posts
    90

    Re: Macro changing font color to white instead of gray

    sorry about that. attached is macro enabled workbook.
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    08-09-2012
    Location
    British Columbia
    MS-Off Ver
    Excel 2010
    Posts
    189

    Re: Macro changing font color to white instead of gray

    Better idea...... post the macros without the workbook.

  5. #5
    Registered User
    Join Date
    09-03-2013
    Location
    Elgin, IL
    MS-Off Ver
    Excel 2010
    Posts
    90

    Re: Macro changing font color to white instead of gray

    FIRST, HERE'S THE MACRO THAT WORKS WHICH FIRST HIDES ROWS AND MAKES CHANGES AS RECORDED:

    Sub Show_Subtotals_as_Totals()
    '
    ' Show_Subtotals_as_Totals Macro
    '

    '
    Rows("63:64").Select
    With Selection.Font
    .Name = "Calibri"
    .Size = 12
    .Strikethrough = False
    .Superscript = False
    .Subscript = False
    .OutlineFont = False
    .Shadow = False
    .Underline = xlUnderlineStyleNone
    .TintAndShade = 0
    .ThemeFont = xlThemeFontMinor
    End With
    Selection.Font.Bold = True
    With Selection.Font
    .ThemeColor = xlThemeColorLight1
    .TintAndShade = 0
    End With
    Rows("65:66").Select
    Selection.EntireRow.Hidden = True
    End Sub
    Sub unhide_totals()
    '
    ' unhide_totals Macro
    '

    '
    Rows("64:67").Select
    Rows("64:67").EntireRow.AutoFit
    Rows("63:64").Select
    Range("A64").Activate
    With Selection.Font
    .Name = "Calibri"
    .Size = 10
    .Strikethrough = False
    .Superscript = False
    .Subscript = False
    .OutlineFont = False
    .Shadow = False
    .Underline = xlUnderlineStyleNone
    .ThemeColor = xlThemeColorLight1
    .TintAndShade = 0
    .ThemeFont = xlThemeFontMinor
    End With
    Selection.Font.Bold = False
    Rows("63:64").Select
    With Selection.Font
    .ThemeColor = xlThemeColorDark1
    .TintAndShade = -0.499984740745262
    End With
    Range("D63").Select
    End Sub

    SECONDLY, HERE'S THE MACRO THAT ISN'T WORKING AS RECORDED:

    Sub Show_Subtotals_as_Totals()
    '
    ' Show_Subtotals_as_Totals Macro
    '

    '
    Rows("63:64").Select
    With Selection.Font
    .Name = "Calibri"
    .Size = 12
    .Strikethrough = False
    .Superscript = False
    .Subscript = False
    .OutlineFont = False
    .Shadow = False
    .Underline = xlUnderlineStyleNone
    .TintAndShade = 0
    .ThemeFont = xlThemeFontMinor
    End With
    Selection.Font.Bold = True
    With Selection.Font
    .ThemeColor = xlThemeColorLight1
    .TintAndShade = 0
    End With
    Rows("65:66").Select
    Selection.EntireRow.Hidden = True
    End Sub
    Sub unhide_totals()
    '
    ' unhide_totals Macro
    '

    '
    Rows("64:67").Select
    Rows("64:67").EntireRow.AutoFit
    Rows("63:64").Select
    Range("A64").Activate
    With Selection.Font
    .Name = "Calibri"
    .Size = 10
    .Strikethrough = False
    .Superscript = False
    .Subscript = False
    .OutlineFont = False
    .Shadow = False
    .Underline = xlUnderlineStyleNone
    .ThemeColor = xlThemeColorLight1
    .TintAndShade = 0
    .ThemeFont = xlThemeFontMinor
    End With
    Selection.Font.Bold = False
    Rows("63:64").Select
    With Selection.Font
    .ThemeColor = xlThemeColorDark1
    .TintAndShade = -0.499984740745262
    End With
    Range("D63").Select
    End Sub

  6. #6
    Forum Contributor
    Join Date
    08-15-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    349

    Re: Macro changing font color to white instead of gray

    I've used the bottom code and it's working fine. Can you please use code tags next time.
    Please click the * Add Reputation if this helps
    If solved remember to mark Thread as solved

    "I'm glad to help and this is not meant to sound smart, but either you have super-human vision to see all those controls cleared one by one with the code I posted, or your computer is really slow."

  7. #7
    Forum Contributor
    Join Date
    08-09-2012
    Location
    British Columbia
    MS-Off Ver
    Excel 2010
    Posts
    189

    Re: Macro changing font color to white instead of gray

    Try changing the code to specify the specific color
    Please Login or Register  to view this content.
    Check this out for color numbers.

  8. #8
    Registered User
    Join Date
    09-03-2013
    Location
    Elgin, IL
    MS-Off Ver
    Excel 2010
    Posts
    90

    Re: Macro changing font color to white instead of gray

    @Blokeman. Forgive my ignorance. I don't know what "code tags" are.

  9. #9
    Forum Contributor
    Join Date
    08-15-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    349

    Re: Macro changing font color to white instead of gray

    Highlight your code and click the [#] button at the top of the post window (if you are editing an existing post, press Go Advanced to see the [#] button).

    Read this #3;http://www.excelforum.com/forum-rule...rum-rules.html

  10. #10
    Valued Forum Contributor
    Join Date
    08-22-2011
    Location
    Auckland
    MS-Off Ver
    Excel 2019
    Posts
    716

    Re: Macro changing font color to white instead of gray

    You should qualify which worksheet you want the code to operate on rather than use select.
    I think the code below does what you want, is easier to understand & easier to change if you want to.
    Cheers

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Macro to add data labels and color font white in Active Tab for all charts?
    By Dude to Excel Dude in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-12-2014, 01:54 PM
  2. Changing font Color linked to Date Key through macro
    By JPSIMMON in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-19-2014, 04:38 PM
  3. [SOLVED] For all cells with font size bigger than 9, make that cell bold and color white
    By jasondu in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-18-2012, 02:18 PM
  4. Macro to change cell background from gray to white
    By t0m in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-01-2011, 04:08 PM
  5. Fill Color and Font Color stay Black and White
    By Hors Categorie in forum Excel General
    Replies: 1
    Last Post: 05-10-2005, 07:20 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1