+ Reply to Thread
Results 1 to 6 of 6

Hide and Unhide text

  1. #1
    Registered User
    Join Date
    02-18-2011
    Location
    Midwest, USA
    MS-Off Ver
    Excel 2007
    Posts
    23

    Hide and Unhide text

    I have a range of cells that are conditionally formatted based on their value. The only conditional formatting is the fill color. So if A1=0, fill is White, if A1<.92, fill is green, if A1>.93 and < 1.05, fill is gray and if A1>1.06, fill is blue.

    What I would like to be able to do is hide or unhide the text at will, with a key combination or a button. Essentially click a button and have the text color match the fill color, click another button and have the text revert to black.

    I tried to write a macro that would match the above conditions to have the text color match the cell color, but it seems I can’t “regular” format the text if there is conditional formatting already applied to the cell. I could conditional format the text as above, but then I am unable to toggle back and forth between hide and unhide.

    If someone knows of a way to hide and unhide the text I would be very thankful
    Last edited by Jumper1; 10-25-2011 at 11:37 AM.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,434

    Re: Hide and Unhide text

    See the attached example

    Regards
    Attached Files Attached Files
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    02-18-2011
    Location
    Midwest, USA
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: Hide and Unhide text

    That is great, I'm not sure how it works so any explanation would be appreciated. I'm going to plug it into my spreadsheet and give it a test.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,434

    Re: Hide and Unhide text

    It just uses Conditional Formatting. For each condition, there are two CF conditions; one that just tests for the original condition and formats the background colour and the other that also checks cell K1. If K1 is non-blank, it applies the original format and formats the font the same colour as the background colour.

    If you want a button, you could make it toggle the content of cell K1

    Regards

  5. #5
    Registered User
    Join Date
    02-18-2011
    Location
    Midwest, USA
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: Hide and Unhide text

    Your solution is exactly what I was looking for, works perfect in my workbook. Thank you very much.

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,434

    Re: Hide and Unhide text

    You're welcome.

    Regards

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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