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

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
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,224,813
Messages
6,181,117
Members
453,021
Latest member
Justyna P

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