+ Reply to Thread
Results 1 to 7 of 7

Clear Contents

  1. #1
    Forum Contributor
    Join Date
    10-17-2018
    Location
    Knoxville, TN
    MS-Off Ver
    Office 365
    Posts
    214

    Clear Contents

    Here is a small code that doesn't work, but maybe some can fix it. I have a ClearContents Button that removes the content of a cell that has been CF formatting to change the font to red, but if it's not red, I want to give a little message stating the black font is ok. It goes like this


    Please Login or Register  to view this content.
    The above is the actual code, but would like to do it this way.


    Please Login or Register  to view this content.

    Any help would be appreciated.

  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,424

    Re: Clear Contents

    Try using
    Please Login or Register  to view this content.
    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
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Clear Contents

    Since coloring is done by CF we cannot just use Selection.Font.Color because XL won't recognize the color set by that CF.

    We need to add DisplayFormat to do so.

    Please Login or Register  to view this content.
    Last edited by bakerman2; 09-18-2021 at 09:03 PM. Reason: Tested with CF
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  4. #4
    Forum Contributor
    Join Date
    10-17-2018
    Location
    Knoxville, TN
    MS-Off Ver
    Office 365
    Posts
    214

    Re: Clear Contents

    Exactly what I needed. Thanks

  5. #5
    Forum Contributor
    Join Date
    10-17-2018
    Location
    Knoxville, TN
    MS-Off Ver
    Office 365
    Posts
    214

    Re: Clear Contents

    TMS, sorry didn't try yours, but bakerman2 work, and thanks anyway

  6. #6
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Clear Contents

    Your welcome and thanks for rep+.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  7. #7
    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,424

    Re: Clear Contents

    You're welcome. Thanks for the rep.

    I should read the question properly

+ 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. [SOLVED] Clear Contents depending on cell contents
    By terratushi in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-15-2017, 08:02 PM
  2. Clear merged cell contents in comand button(clear all)
    By mohan_984 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-25-2015, 10:39 AM
  3. clear contents of entire sheet except the contents of the table
    By wayneg in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-06-2015, 08:41 AM
  4. [SOLVED] Clear contents based on contents of another cell
    By Katrina DTE in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-13-2013, 02:44 PM
  5. Clear row contents and copy row contents.
    By fatalcore in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-19-2011, 01:08 PM
  6. Copy list contents down, then clear contents
    By hektisk in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-07-2011, 04:34 PM
  7. Clear sheet contents but retain Clipboard contents
    By nebb in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-25-2007, 01:42 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