Can anyone help?
I'm try to create a macro that searches the whole of a spreadsheet and finds any records that match.....
I've managed to find this...
But what I really want it to do is search and display only the records that match and give an error message if nothing is found, anyone?![]()
Sub myfind() Dim Message, Title, Default, SearchString Message = "Enter Permit Number/Car Registration Number" ' Set prompt. Title = "Find Permit/Registration Number" ' Set title. Default = "" ' Set default. ' Display message, title, and default value. SearchString = InputBox(Message, Title, Default) 'SearchString = "Rob" Set S = Sheets.Application For Each S In Application.Sheets With S.Range("A1:IV65536") Set F = .Find(SearchString, MatchCase:=True, LookAt:=xlWhole, LookIn:=xlValues) If F Is Nothing Then Else Location = F.Address S.Select Range(Location).Select Exit For End If End With Next S End Sub











LinkBack URL
About LinkBacks
Register To Reply

Bookmarks