Consulting

Results 1 to 15 of 15

Thread: Remove conditional formatting but keep format

  1. #1

    Remove conditional formatting but keep format

    Dear All

    I would like to be able to delete all of the the conditions but keep the formatting that was generated by the CF in the first place.

    If this can be done it would be nice to be able to do it either for the active sheet or a selected range.

    Fingers crossed.

  2. #2
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    Reading conditional formats and their conditions will vary depending on your Excel version. So, tell us your Excel version first.

  3. #3
    Kenneth

    Thank you for your reply.

    I think its 2003 - I do know that its not 2007.

  4. #4
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    I have a sub for that on my other computer. Be back in 4 hr.

  5. #5
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    This should do it for Excel 2004 and earlier. For later some tweeks need to be added.
    Attached Files Attached Files

  6. #6

    Remove conditional formatting but keep format

    Mike

    Thank you so much for this.

    The code works fine in the CF workbook but doesn't appear be working elsewhere.

    As it won't work across workbooks I have copied the code from the example file into the appropriate workbook but nothing seems to be happening after I have selected the range and pressed ok, have I missed something fundemental?

    These are the three conditions that I have in one of the selected cells:

    Condition 1 Formula Is =AND(B7>=C7*1.2,C7>0) Format = Black Text on a Pastel Red background

    Condition 2 Formula Is =AND(B7>=C7*0.8,B7<=C7,C7>0) Format = Black Text on a Pastel Green background

    Condition 3 Cell Value Is Greater than =C7 Format = Black Text on a Pastel Amber background

  7. #7
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    If I have the code in Workbook1.xls, run the macro and select a sheet from another (open) workbook, it works for me.

  8. #8

    Remove conditional formatting but keep format

    Mike

    Sorry for long delay in coming back.

    I have your CF workbook open along with another one, that has the workbook and sheets unprotected, yet when I press the button it will not allow me to select anything from the 2nd workbook.

    Strange

    According to the Help/About option I am using Excel 2002 (10.6866)

  9. #9
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    In a new workbook, put this in a normal module. Open a couple of other workbooks and see if you can change books while the dialog is asking you for a cell
    [VBA]Sub test()
    MsgBox Application.InputBox("select a cell", Type:=8).Address(, , , True)
    End Sub[/VBA]

  10. #10

    Remove conditional formatting but keep format

    Mike

    I have now had a chance to run the new line of code that you suggested in a new workbook and module and as before I am unable to move across to another open workbook to select some cells.

  11. #11
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    Is the second workbook opened in the same instance of Excel?

    On those few occasions that I work on a Windows machine, I sometimes inadvertently open a new instace of Excel when my goal is to open another workbook in the same instance.

    If I remember correctly, clicking on a file icon opens a new instance of Excel. Using the Open command from within an instance does not open another. (Windows users, please correct me if I'm wrong.)

  12. #12
    VBAX Mentor
    Joined
    Feb 2009
    Posts
    493
    Location
    Opening a file from an icon doesn't open a new instance but opening excel from the start menu and then opening another file does.
    -----------------------------------------
    The more you learn about something the more you know you have much to learn.

  13. #13
    Mike

    I've opened up another file within the current occurance of Excel and I still cannot pick up anything from the other worksheet.

  14. #14
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    If the little code in post #9 is not picking up cells in another workbook, I have no clue as to what might be going on.

  15. #15
    Is there something special that needs to be altered for 2010?

Posting Permissions

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