Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using Find in VBA
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? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using Find in VBA
Dim sh as worksheet, rng as range
for each sh in worksheets sh.Activate set rng = Cells.Find(What:="ERROR", After:= _ ActiveCell, LookIn:=xlValues) if not rng is nothing then msgbox "Error found at " & rng.Address(0,0,xlA1,True) exit sub end if Next -- Rgards, Tom Ogilvy "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? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Find and Replace - delete the remainder of the text in the cell after my Find | Excel Programming | |||
Find First Non blank cell than find column header and return that value | Excel Worksheet Functions | |||
Despite data existing in Excel 2002 spreadsheet Find doesn't find | Excel Discussion (Misc queries) | |||
find and delete duplicate entries in two columns or find and prin. | Excel Programming | |||
find and delete text, find a 10-digit number and put it in a textbox | Excel Programming |