joshlwilliams
New Member
- Joined
- Aug 4, 2011
- Messages
- 3
I have the following code below to search the selected sheet. I'd like to alter it to search multiple sheets in my workbook. I've tried everything I can think of and have been highly unsuccessful.
Any suggestions?
Sub FindMe()
Dim intS As Integer
Dim rngC As Range
Dim strToFind As String, FirstAddress As String
Dim wSht As Worksheet
Application.ScreenUpdating = False
intS = 1
'This step assumes that you have a worksheet named
'Search Results.
Set wSht = Worksheets("Search")
strToFind = InputBox("Enter the SIC code to find")
'Change this range to suit your own needs.
With ActiveSheet.Range("A1:G2000")
Set rngC = .Find(what:=strToFind, LookAt:=xlPart)
If Not rngC Is Nothing Then
FirstAddress = rngC.Address
Do
rngC.EntireRow.Copy wSht.Cells(intS, 1)
intS = intS + 1
Set rngC = .FindNext(rngC)
Loop While Not rngC Is Nothing And rngC.Address <> FirstAddress
End If
End With
End Sub
Any suggestions?
Sub FindMe()
Dim intS As Integer
Dim rngC As Range
Dim strToFind As String, FirstAddress As String
Dim wSht As Worksheet
Application.ScreenUpdating = False
intS = 1
'This step assumes that you have a worksheet named
'Search Results.
Set wSht = Worksheets("Search")
strToFind = InputBox("Enter the SIC code to find")
'Change this range to suit your own needs.
With ActiveSheet.Range("A1:G2000")
Set rngC = .Find(what:=strToFind, LookAt:=xlPart)
If Not rngC Is Nothing Then
FirstAddress = rngC.Address
Do
rngC.EntireRow.Copy wSht.Cells(intS, 1)
intS = intS + 1
Set rngC = .FindNext(rngC)
Loop While Not rngC Is Nothing And rngC.Address <> FirstAddress
End If
End With
End Sub