View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ben Jimenez Ben Jimenez is offline
external usenet poster
 
Posts: 4
Default Search Mutiple Excel Sheets.

Hello,

This is just a follow up to those that helped me figure
out how to search mutiple sheets. Here is the code i used,
i made some small modifications to it. I did not want to
search the first two sheets of my workbook so i added a
little counter to skip these two. Thanks again for those
who helped me out.

Ben

Dim sh As Worksheet
Dim rng As Range
Dim sTarget As String
Dim sCnt As Integer


sTarget = TextBox1.Text
For Each sh In ThisWorkbook.Worksheets
If sCnt 1 Then
Set rng = Nothing
Set rng = sh.Cells.Find(sTarget)

If Not rng Is Nothing Then
sh.Activate
rng.Select
Exit Sub
End If
End If
sCnt = sCnt + 1
Next

MsgBox "The search data was not found."