I think you just put the exit sub in the wrong place (outside the if
statement)
Die_Another_Day
For Each rng in Selection
If rng.Interior.ColorIndex < 4 Then
MsgBox "You did not select the correct cells for scheduling",
vbCritical, "Improper Selection"
Exit Sub
End If
Next
Brian J. Matuschak wrote:
OK, so I pressed the wrong key before my message was complete, but I'll
reiterate what I was trying to do. I need to check the color of each cell
within a one-row selection so that if the scheduler picks the wrong
selection, then they do not receive an Outlook appointment. I need to use a
command button to provide flexibility. Here's part of the sub:
Dim rng As Range
For Each rng in Selection
If rng.Interior.ColorIndex < 4 Then
MsgBox "You did not select the correct cells for scheduling",
vbCritical, "Improper Selection"
End If
Exit Sub
Next
What am I missing here?
Thanks,
--
Brian J. Matuschak