Thread: MSG box if
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
tom tom is offline
external usenet poster
 
Posts: 570
Default MSG box if

That did it...Thanks Kevin!

"Kevin B" wrote:

I selected range A1:A10 and C1:C10 and assigned the range name of DataRange
to the selected cells. This was done in Sheet1 of the workbook. In the
sheet module for Sheet1 I assigned the following event to Worksheet_Change
event:

Private Sub Worksheet_Change(ByVal Target As Range)

Dim r As Range
Dim intCell As Integer

Set r = Range("DataRange")

For intCell = 1 To r.Cells.Count
If r.Cells(intCell) = "Y" Or r.Cells(intCell) = "N" Then
MsgBox "Yo! What's up?"
End If
Next intCell

Set r = Nothing
Exit Sub

End Sub

--
Kevin Backmann


"Tom" wrote:

Hi All,
I need a MSG box to come up if any cells from A1:A10 AND/OR C1:C10 contain
BOTH a "Y" and a "N". They can contain ONLY either "Y's" or "N's"....not both.
Any suggestions?

Thanks,
Tom