COMPARING TWO COLUMNS AND DISPLAYING MSGBOX
On Saturday, December 15, 2012 8:15:50 AM UTC-8, joeu2004 wrote:
wrote:
naga rajan wrote:
I need a msgbox to pop up if either A1 or B1 greater than C1.
[....]
Private Sub Worksheet_Change(ByVal Target As Range)
If Range("A1").Value Or Range("B1").Value Range("C1") Then
MsgBox "A1 or B1 is greater than C1", vbOKOnly, "High Hopes"
End If
End Sub
Correction:
If Range("A1") Range("C1") Or Range("B1") Range("C1") Then
Also note that the Worksheet_Change event macro goes into a worksheet
module, not a normal module. Right-click on the worksheet tab to open the
worksheet module in the VBA window.
Whoa, good catch Joeu2004! It's not clear to me why my line produces the msgbox when both A1 & B1 are LESS than C1. And I tested my code, but missed that somehow...???
Howard
|