Hi
I am trying to get the code that I worte to ask the user if they would like to contine searching the entire workbox for the value enter in the textbox.
When I run the code it finds the value on the first spreadsheet, But this value could be on other spreadsheet within the workbook. How do I get the code to ask once it finds it on the
first spreadsheet to continue searching till it has search the whole workbook? Then I need it to search the whole directory to find if value exist on any other workbook
I hope that I am explaining this right. I am not a person that writes code very well
Below you will see my code
Sub SearchAllSheets()
Dim ws As Worksheet
Dim rFound As Range
Dim strName As String
On Error Resume Next
strName = InputBox("Cross Ref#")
If strName = "" Then Exit Sub
For Each ws In Worksheets
With ws.UsedRange
Set rFound = .Find(What:=strName, After:=.Cells(1, 1), LookIn:=xlValues, LookAt:=xlWhole)
If Not rFound Is Nothing Then
Application.GoTo rFound, True
Exit Sub
End If
End With
Next ws
On Error Goto 0
MsgBox "Value not found"
End Sub
Bookmarks