View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
L. Howard L. Howard is offline
external usenet poster
 
Posts: 852
Default Placing the MsgBox "No ID found" statement in my code??

I want to have a notification of "Not Found" if the ID number does not exist on any worksheet, except sheet 1, which is not searched.

I know where to put it if looking at only one sheet, but everywhere I tried it increments sheet by sheet as Not Found until an Id is found then increments on sheets past the found ID.

Thanks.
Howard

'Else
' MsgBox "No ID found"



Sub AllMySheets()

Dim ws As Worksheet
Dim FindString As String
Dim Rng As Range

FindString = InputBox("Enter a Client ID numbet")

For Each ws In ThisWorkbook.Worksheets
If ws.Name < "Sheet1" Then

If Trim(FindString) < "" Then

With ws
Set Rng = .UsedRange.Find(What:=FindString, _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlNext, MatchCase:=False, _
SearchFormat:=False)
If Not Rng Is Nothing Then
MsgBox Rng.Address & " " & ws.Name
End If

End With

End If

End If
Next ws

End Sub