Hi
Dim the variables properly. This should work.
Code:Sub SearchBookss() Dim Sht As Worksheet Dim SearchWord As String Dim WordAddress As Range Dim CheckCell As String Dim Addr As String Dim i As Long Application.ScreenUpdating = 0 SearchWord = InputBox("Enter the string to search for") On Error GoTo Xit For i = 1 To Workbooks.Count For Each Sht In Workbooks(i).Worksheets Application.Goto Sht.Cells(1) FindAnother: Set WordAddress = Sht.UsedRange.Find(What:=SearchWord, lookat:=xlPart, MatchCase:=False) If Not WordAddress Is Nothing Then CheckCell = WordAddress.Address Do Set WordAddress = Sht.UsedRange.FindNext(WordAddress) Addr = WordAddress.Address MsgBox Workbooks(i).Name & Chr(13) & Sht.Name & vbLf & Addr Loop Until Addr = CheckCell Application.Goto Sht.Range(CheckCell) End If Next NextBook: Next i Application.ScreenUpdating = 1 Exit Sub Xit: MsgBox Err.Description Application.ScreenUpdating = 1 End Sub




Reply With Quote
Bookmarks