+ Reply to Thread
Results 1 to 5 of 5

Format cell/text color via VBA and supercede manual cell formatting like Cond.Format does

  1. #1
    Forum Contributor
    Join Date
    11-28-2013
    Location
    Here
    MS-Off Ver
    Excel 2010
    Posts
    119

    Format cell/text color via VBA and supercede manual cell formatting like Cond.Format does

    Hello,

    I have a worksheet with many hundreds of rows and about 40 columns wide. It currently has a lot of Conditional Formats on many cells on every row to control color of cell and color of text as info in input. In many cases there are multiple Conditional Formats in cells.

    The multitude of conditional formats are now causing a real slow down when inserting or deleting rows or columns in the workbook. It currently takes over 60 seconds to do so. I deleted all conditional formatting in the workbook and things get speedy again.

    I am trying out some code I found to emulate conditional formatting.
    Please Login or Register  to view this content.
    This code works quite well but my issue is the cell/text color can be manually changed afterwards.

    Conditional Formatting supercedes all manual cell/text color formatting. Is it possible to achieve the same result with VBA?

    Please note that users do need to manually set cell/text color for their own use and thus it is not an option to simply lock the sheet and disable cell formatting.

    Thank you for any help.

    TV

  2. #2
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Format cell/text color via VBA and supercede manual cell formatting like Cond.Format d

    but the users actually can't change cell/text color as you use conditional formatting, right?
    If so, you can lock the sheet. Don't you?
    Pierre Leclerc
    _______________________________________________________

    If you like the help you got,
    Click on the STAR "Add reputation" icon at the bottom.

  3. #3
    Forum Contributor
    Join Date
    11-28-2013
    Location
    Here
    MS-Off Ver
    Excel 2010
    Posts
    119

    Re: Format cell/text color via VBA and supercede manual cell formatting like Cond.Format d

    Hello Pierre,

    Correct, currently if a cell meets a conditional format, the cell color or cell text will change according to the condition. Once a conditional format is applied, you are free to select a different color for cell/text, but you will not see this new manually selected color until the conditional format for the cell is no longer applied due to a value being changed.

    We currently do lock our sheets but as mentioned, users still need to alter cell color for their own use, for example on cells that will never have any conditional formatting, so we can not lock out the ability for the user to manually change cell/text color.

  4. #4
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Format cell/text color via VBA and supercede manual cell formatting like Cond.Format d

    You can protect a sheet while allowing the user to modify cells' format.
    Look at the options in the protecting window.
    regards

  5. #5
    Registered User
    Join Date
    12-09-2009
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Format cell/text color via VBA and supercede manual cell formatting like Cond.Format d

    Pierre, I'm not sure If I don't understand or if you are not understanding me.

    We protect our sheets but users still need to format cells (apply color) so we can not lock out that option.

    We use conditional formatting on some columns but there are so many conditional formats it slows down the insertion or deletion of a row or column (even when vba is used to do so).

    To prevent the slow down I would like to apply code like the example in my first post instead of using conditional formatting. The drawback is that using the code does not prevent a user to alter cell/text color of a cell already altered by code. The beauty of conditional formatting is it that color applied to a cell via conditional formatting can not be changed by the used as long as the rule of the conditional format is met.

    So I am looking for code that can possibly protect cell color even if a user tries to change the color.

+ 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. Change a Range's cell background color to that of another cell's cond. format color
    By kamelkid2 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-31-2014, 12:57 PM
  2. Replies: 5
    Last Post: 05-04-2011, 05:01 PM
  3. Replies: 1
    Last Post: 05-03-2011, 05:46 PM
  4. format cell based on cond. of another
    By dr mint in forum Excel General
    Replies: 2
    Last Post: 03-31-2010, 11:50 PM
  5. Replies: 4
    Last Post: 01-09-2006, 04:35 AM

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