View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Auric__ Auric__ is offline
external usenet poster
 
Posts: 538
Default Pop up message needed dependend on certain conditions

Norbert wrote:

In cell range C7:C14 the cells can have different values (1, 2, 3,
.....) In case there is only 1 kind of value (only value 1, or only
value 2) I'd like to get a message (pop up, or in a certain cell), which
says "blablabla" I'd like to get different messages for different
values, though.

For example: C7 = 1
C8 = 1
C9 = 1
Message to pop up: "Please be aware that pattern repeat to be divisible
by 4"

C7 = 2
C8 = 2
C9 = 2
C10 = 2
Message to pop up: "Please be aware that pattern repeat to be divisible
by 12"

For example: C7 = 1
C8 = 2
C9 = 1
No message to pop up


This ensures that there are at least 2 unique values in C7:C14, and at least
2 non-blank cells. If there aren't (i.e. everything's the same) then you get
a msgbox.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim L0, L1, tracker As Boolean
If (Target.Column < 3) Or (Target.Row < 7) Or (Target.Row 14) Then _
Exit Sub
For L0 = 7 To 13
If Cells(L0, 3).Value < "" Then
For L1 = 8 To 14
If Cells(L1, 3).Value < "" Then
tracker = True
If Cells(L0, 3).Value < Cells(L1, 3).Value Then Exit Sub
End If
Next
End If
Next
If tracker Then MsgBox "your message here"
End Sub

--
I wonder if he thinks he's the hero or the villain?