Conditional Locking if Cells below are blank

KCrtz

New Member
Joined
Jan 24, 2020
Messages
2
Office Version
  1. 365
Platform
  1. Windows
I was able to get the coding below to working using the logic in this link below; however, when I apply this to 30 lines of data I get so many message boxes you have to force excel to close to move on. How can I consolidate this code to only show one error message?

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Intersect(Target, Range("G13:G41")) Is Nothing Then Exit Sub
If Range("G12") = "" Then
MsgBox ("Please completed blend in order")
Range("G12").Select
End If
If Intersect(Target, Range("G14:G41")) Is Nothing Then Exit Sub
If Range("G13") = "" Then
MsgBox ("Please completed blend in order")
Range("G13").Select
End If
If Intersect(Target, Range("G15:G41")) Is Nothing Then Exit Sub
If Range("G14") = "" Then
MsgBox ("Please completed blend in order")
Range("G14").Select
End If
If Intersect(Target, Range("G16:G41")) Is Nothing Then Exit Sub
If Range("G15") = "" Then
MsgBox ("Please completed blend in order")
Range("G15").Select
End If
End Sub

 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Intersect(Target, Range("G13:G41")) Is Nothing Then Exit Sub
If ActiveCell.Offset(-1, 0) = "" Then
MsgBox ("Please completed blend in order")
Application.EnableEvents = False
ActiveCell.Offset(-1, 0).Select
Application.EnableEvents = True
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,985
Messages
6,122,603
Members
449,089
Latest member
Motoracer88

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