I am working on a project that requires locked cells based on how the cells are conditionally formatted. In this instance the conditionally formatted cells have interior color 15.

This is the rule I am using for the conditional formatting:

IF: =($D$2+$M8)>=(V$1)

APPLIES TO: $V$8:$AG$229,$AI$8:$AT$229,$AW$8:$BH$229,$BJ$8:$BU$229

FORMAT: Interior Color Code 15

I need a VBA code that will lock all the cells on the entire sheet that have that conditional formatting applied. Since the color of the cells is based on a conditional format, none of the VBA codes I can find will recognize the color.

Can anyone help?

  • Look into DisplayFormat – Scott Craner Nov 29 '18 at 17:49
  • Or better yet just do the actual same test in the code. If A+ B > C then – Scott Craner Nov 29 '18 at 17:51
  • That you for reaching out Scott. Here is the thing, I am not very well versed in writing the code. – OldBen21 Nov 29 '18 at 17:58
  • Well, there is the problem. This site is not a code for me site. It will help overcome specific problems with existing code. – Scott Craner Nov 29 '18 at 18:00
  • 1
    nevermind....i fixed it. thanks for your help. I wasn't intending for someone to write the code for me but the link you sent help me fix it....two little words "DisplayFormat" fixed the code. Thank you again! – OldBen21 Nov 29 '18 at 18:03

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.