Follow up on question "search for text in a file in a folder from an open file"
Posted on 2014-01-21
I have been using this code provided by Rgonzo1971 which has been working fine, until last week. Now it no longer returns Yes only No
when I check the file manually and do a 'Find' I can see the item I am looking for. When I run the macro it puts "No" in J6
Would you have any idea what might be causing this
I have done all the usual checks, looking for spaces, checking the format etc.
Application.ScreenUpdating = False
strReference = "aaaaaaaaa" ' Change here your reference
Set SrcWbk = Workbooks.Open(Filename:="G:\Clients\Open Invoice\Open Invoice Documentation Database - UPDATED.xlsx")
For Each sh In SrcWbk.Sheets
Set FoundRef = .Cells.Find(What:=strReference, LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
If FoundRef Is Nothing Then
ThisWorkbook.Sheets("Sheet1").Range("J6") = "No"
ThisWorkbook.Sheets("Sheet1").Range("J6") = "Yes"
Application.DisplayAlerts = False
Application.DisplayAlerts = True