Trigger MsgBox for Incomplete Input

Yevette

Active Member
Joined
Mar 8, 2003
Messages
336
Hello All,

Can someone help me with VBA to trigger a msgbox if the user inputs info into A1, but fails to input into B1:D1 prior to moving to the next row to input data (or doing anything else on the worksheet). I'd like the message to say "INPUT ERROR - MUST COMPLETE SHADED CELLS", or something to that effect. I've done something similar before, but that was to keep the user from saving the worksheet without completing the form properly.

Clear as mud? Thanks so much for your help!!!
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Something like this should work:

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Row > 1 Then
        If Target.Column = 1 And (Len(Target.Offset(-1, 1).Value) = 0 Or Len(Target.Offset(-1, 2).Value) = 0 Or Len(Target.Offset(-1, 3).Value) = 0) Then
            MsgBox "Please complete shaded areas in row " & Target.Row - 1 & " before continuing.", vbCritical, "Incomplete Entry"
            Application.EnableEvents = False
            Target.Value = ""
            Application.EnableEvents = True
        End If
    End If
    
End Sub
 
Upvote 0
Hi and thank you for your response. I tried the code but it didn't work. I don't think I accurately explained what I am trying to do (first of all because I used the wrong row numbers). So let me try again: If a selection is made from the drop down list in B122, then cells C122:F122 highlight to yellow (conditional formatting) to prompt the user to fill in required information. I would like to display an error message to stop the user from progressing to the next row (B123) until he fills out C122:F122 (and there are no yellow highlighted cells in the row), and so on through row B126. Also, the spreadsheet cannot be saved if there are yellow highlighted cells or an error message displays and prevents saving. The entire range is B122:F126

Clear as mud? Thanks again for your input and help!
 
Upvote 0

Forum statistics

Threads
1,224,602
Messages
6,179,848
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top