Home |
Search |
Today's Posts |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
And, to be consistent with my use of
an object variable for B2, it would be better to replace: MsgBox "CELL B2 CANNOT BE LESS " _ & "THAN CELL A2, TRY AGAIN" with MsgBox Prompt:="CELL " & Rng2.Address(0, 0) _ & " CANNOT BE LESS " _ & "THAN CELL A2, TRY AGAIN" --- Regards. Norman "Norman Jones" wrote in message ... Hi JLGWhiz, To avoid a Run-time 13 error if the value of a multi-cell range is changed, more robust might be the following version: '========= Private Sub Worksheet_Change(ByVal Target As Range) Dim Rng As Range Dim Rng2 As Range With Me Set Rng = .Range("A2") Set Rng2 = .Range("B2") End With If Not Intersect(Rng2, Target) Is Nothing Then If Rng2.Value < Rng.Value Then MsgBox "CELL B2 CANNOT BE LESS " _ & "THAN CELL A2, TRY AGAIN" Rng2.Select End If End If End Sub '<<========= --- Regards. Norman |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Compare text string of a cell in Column A VS another cell in Colum | New Users to Excel | |||
Compare text string of a cell in Column A VS another cell in Colum | Excel Discussion (Misc queries) | |||
Compare text string of a cell in Column A VS another cell in Colum | Excel Worksheet Functions | |||
Compare text string of a cell in Column A VS another cell in Colum | Excel Programming | |||
How do I compare cells and if FALSE compare to next cell in EXCEL | Excel Worksheet Functions |