VBA code to make a cell mandatory on save if previous cell says Fail

  • I'm currently creating a document that would allow supervisors to audit their people.

    I'm looking for a way to prevent saving if cells I and J are not completed if the person failed the previous audit.

    Here's photo of what my current document looks like to kind of get an idea:

    [Blocked Image: https://i.stack.imgur.com/ET7Ae.png]

    I have a formula set in column H to put the phrase Pass or Fail if a certain point range is not met:

    =IF(G4="","",IF(G4>=85%,"Pass",IF(G4<85%,"Fail"," ")))

    I need to make it that they have to fill in all data after this if the associate doesn't reach that 85% point goal. The following code is what I have so far but I cannot get it to work properly. Any changes or new code is happily accepted.

    technically it would only be the cell of H4 but I need it for the entire column as this would be an ongoing document for the month. so the usage would be you would select the person being audited what machine they are working on Column F would produce the points possible you would enter the Points scored on column E G would give your percentage and the formula in H would generate your Pass Or Fail value. if Value H is Fail I would like it to lock out saving untill the Fill in Column I and J.

  • You could do a COUNTIFS and see if there's at least one data point.

    Best Regards,
    Luke M
    "A little knowledge is a dangerous thing."

  • You could do a COUNTIFS and see if there's at least one data point.

    Works like a Charm! I didn't even think of doing a count!

    Thanks so much!!!!!

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!