View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Message Box if Data appears in Column

Sub ErrorCatcher()
Dim r As Range, warn As Boolean
warn = False
Set r = Range("L2:L1250")
For Each rr In r
If InStr(rr.Value, "Error") 0 Then
warn = True
End If
Next

If warn Then
MsgBox ("WARNING!")
End If
End Sub

--
Gary''s Student - gsnu200857


"Monk" wrote:

Thanks. How could I amend this so that the message box will only appear once,
irrespective of how many times the "error" text appears in the column. At the
moment the box appears each time the "error" value appears. Thanks in advance

"Gary''s Student" wrote:

Sub ErrorCatcher()
Dim r As Range
Set r = Range("L2:L1250")
For Each rr In r
If InStr(rr.Value, "Error") 0 Then
MsgBox ("WARNING monk")
End If
Next
End Sub

--
Gary''s Student - gsnu200857


"Monk" wrote:

I would like a message box to appear if the text "Error" appears in any cell
in the range L2:L1250. Any assistance with a macro would be appreciated.
Thanks
Monk