Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
MSG box if
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
MSG box if
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
MSG box if
Hi Tom,
data validation allow List as list enter Y,N,y,n define error message. Applicable in your case? Regards, Ivan |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|