View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Vergel Adriano Vergel Adriano is offline
external usenet poster
 
Posts: 857
Default Using Find in VBA

maybe something like this:

Sub test()
Dim sht As Worksheet
Dim c As Range

For Each sht In Worksheets
Set c = sht.Cells.Find(What:="ERROR")
If Not c Is Nothing Then
sht.Activate
c.Activate
MsgBox "ERROR FOUND!"
Exit Sub
End If
Next sht
MsgBox "NO ERRORS FOUND"

End Sub


--
Hope that helps.

Vergel Adriano


"nir020" wrote:

I have written the following VBA which is used to find the text "ERROR"
within a worksheet:-

Cells.Find(What:="ERROR", After:= _
ActiveCell, LookIn:=xlValues).Activate

I would like to extend this Sub routine so that it search through the entire
workbook and if the text "ERROR" is found a message box is activated and the
sub broken.

Can anyone help?