+ Reply to Thread
Results 1 to 14 of 14

Conditional Format not working in a Protected Table

  1. #1
    Registered User
    Join Date
    04-02-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    97

    Conditional Format not working in a Protected Table

    See attached.

    I have a table with a Macro (see button " Insert new row" ref Macro "Copyrow") that protects the table and inserts a new row. This part works great. The issue I am having is getting the conditional format to highlight duplicates in all of column C. If I enter in duplicated numbers outside the table it the conditional format works. Even works when the sheet is unprotected IN the table. The second I hit the button to insert a row and enter a duplicated number the conditional formatting stops.


    Any ideas on how to get this working?

    Thank you so much!
    Sample RPT.xlsm

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

    Re: Conditional Format not working in a Protected Table

    Please Login or Register  to view this content.

    Regards, TMS
    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 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,447

    Re: Conditional Format not working in a Protected Table

    I should have said ... I don't know why you are copying a blank row 3. It is unnecessary. Adding rows to a Structured Table will automatically copy formulae, formatting, Conditional Formatting and Data Validation.

    Regards, TMS

  4. #4
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Conditional Format not working in a Protected Table

    Hi antexity

    TMS's Code is spot on, however, you also need to check your Table Size. In the Sample File it's sized incorrectly. Also, the Conditional Formatting Rule should be revised.

    antexity.jpg
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  5. #5
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: Conditional Format not working in a Protected Table

    Your profile shows you have Excel 2010 like I do, so to elaborate a little on what Trevor is saying. If you select cell A3 of the sample file you included you will see that you immediately get a Table Tools tab on the ribbon. Now select cell A6 or the file you attached and you see the tab goes away. That is telling you that the cell you selected is not a part of the table, this is the root of your problem. Trevor's code is addressing the table structure and adding a row to the table, not just the worksheet.
    Click the * Add Reputation button in the lower left hand corner of this post to say thanks.

    Don't forget to mark this thread SOLVED by going to the "Thread Tools" drop down list above your first post and choosing solved.

  6. #6
    Registered User
    Join Date
    04-02-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    97

    Re: Conditional Format not working in a Protected Table

    This is perfect TMS! Another feature that would be nice, is there a way to lock the data entered in the previous rows from being edited with having the current row able to edit. The user would lose the functionality to edit old row once the insert next row button is clicked.

    Thanks again

    Antexity

  7. #7
    Registered User
    Join Date
    04-02-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    97

    Re: Conditional Format not working in a Protected Table

    Thanks jaslake and skywriter for your observations, I have fixed those issues. Thanks!

  8. #8
    Registered User
    Join Date
    04-02-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    97

    Re: Conditional Format not working in a Protected Table

    Also to add to my latest post #6, is there a way to set a password when protecting and prevent from the end-user seeing the password. IE. I click the file and say protect sheet and use a password. Then I start adding rows and since in the macro, the logic is to unlock and lock the sheet, after the first attempt to unlock (and entering the password to unlock) and then lock I lose the password feature. If there is a way to address this and the solution is to hard code the password in the Macro logic, is there a way to prevent the end user from going to the developer tab > macro or view code to see the password?

    Thanks
    Antexity

  9. #9
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: Conditional Format not working in a Protected Table

    This seems to work. Change the password to whatever you want. If you set the worksheet protection manually, meaning how you want it. Select locked or unlocked cells etc., then when you run this you should find the new row unlocked and the other cells locked with the settings you specified.

    Good Luck.

    Please Login or Register  to view this content.
    is there a way to prevent the end user from going to the developer tab > macro or view code to see the password?
    In the Visual Basic Editor > Tools > VBA Project Properties > Protection Tab, the rest is self explanatory.
    Last edited by skywriter; 09-03-2015 at 05:23 PM.

  10. #10
    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,447

    Re: Conditional Format not working in a Protected Table

    Yes, I probably should have mentioned that I deleted a lot of Conditional Format tests.

    I don't think the CF should be applied to the whole of column C. The CF will be managed by Excel as it relates to a Structured Table.

    I think this combines the various aspects so far proposed.

    Please Login or Register  to view this content.

    See the attached updated example.

    Regards, TMS
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    04-02-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    97

    Re: Conditional Format not working in a Protected Table

    All you guys nailed my requirements. I really appreciate your time!. I have added reputations to all if you.

    Thank you!
    Antexity

  12. #12
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Conditional Format not working in a Protected Table

    You're welcome...glad I could help. Thanks for the Rep.

  13. #13
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: Conditional Format not working in a Protected Table

    Thanks for the rep. points.

  14. #14
    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,447

    Re: Conditional Format not working in a Protected Table

    You're welcome. Thanks for the rep.

+ 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] Conditional Format not working as expected
    By scudo in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-10-2015, 10:44 AM
  2. [SOLVED] Conditional Format not working
    By Adam Schaefer in forum Excel General
    Replies: 1
    Last Post: 03-16-2015, 10:22 AM
  3. conditional format not working
    By Roger_the_Dodger_55 in forum Excel General
    Replies: 2
    Last Post: 03-07-2013, 07:56 PM
  4. conditional format not working
    By Roger_the_Dodger_55 in forum Excel General
    Replies: 2
    Last Post: 03-07-2013, 07:02 PM
  5. Keep format of data table after insert a new row on a protected sheet
    By RickyC in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-07-2010, 10:58 AM
  6. Conditional Format not working
    By additude in forum Excel General
    Replies: 20
    Last Post: 09-12-2008, 06:19 AM
  7. [SOLVED] Conditional Format Not Working
    By KMH in forum Excel General
    Replies: 0
    Last Post: 12-22-2005, 01:35 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