Glam Prestige Journal

Bright entertainment trends with youth appeal.

If cell L6 shows yes or no, a message box appears to confirm cell L7 and L8 must be completed . I saw a similar post, but I couldn't get the VBA coding to work for my situation. Any help would be appreciated, thank you.

4

1 Answer

To achieve the goal, I would like to suggest two possible methods.

Method 1, Data Validation:

  • Situation 1, when Cell L6 is filled with either Yes or No.

enter image description here


  • Situation 2, when Cell L6 is filled with neither Yes nor No.

enter image description here


  • Situation 3, when Cell L6 is Blank.

enter image description here


How it works:

  1. Select cells L7 & L8 and from Data Tab click Data Validation.
  2. Set Custom as Validation Criteria and enter this Formula.

=NOT(ISBLANK($L$6))*(OR($L$6="Yes",$L$6="No"))

  1. Finish with Ok

Method 2, VBA (Macro):

  • Right Click the Sheet Tab & hit View Code from the Poped up menu to get VB editor.
  • Copy & Paste this Code as Standard Module with the Sheet.

    Option Explicit
    Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Range("L6")) Is Nothing Then If Target.Value = "Yes" Or Target.Value = "No" Then MsgBox "Now You Can fill L7 & L8" Range("L7").Activate ElseIf Target.Value <> "Yes" Or Target.Value <> "No" Then MsgBox "Target cell must have data Yes Or No,, to fill L7 & L8" Target.Activate End If If Target.Value = "" Then MsgBox "Target Cell Can't be Blank,," Target.Activate End If
    End If
    End Sub

N.B.

  • This code will start responding as soon you fill the Cell L6.

  • You may adjust cell references in the Formula as well as in VBA code as needed.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy