S
Steved
Hello from Steved
The objective is to open and close every file in a
specified Directory which it is doing but why won't it
stop when finding the cell value 2222 in this case.
Thankyou.
Sub Test2()
Dim FName As String
Dim FoundCell As Range
Dim WB As Workbook
ChDrive "C:"
ChDir "C:\Wtt"
FName = Dir("*.xls")
Do Until FName = ""
Set WB = Workbooks.Open(FName)
Set FoundCell = WB.Worksheets(1).Cells.Find
(what:="the value is 2222")
If Not FoundCell Is Nothing Then
Else
End If
WB.Close SaveChanges:=True ' or False
FName = Dir()
Loop
End Sub
The objective is to open and close every file in a
specified Directory which it is doing but why won't it
stop when finding the cell value 2222 in this case.
Thankyou.
Sub Test2()
Dim FName As String
Dim FoundCell As Range
Dim WB As Workbook
ChDrive "C:"
ChDir "C:\Wtt"
FName = Dir("*.xls")
Do Until FName = ""
Set WB = Workbooks.Open(FName)
Set FoundCell = WB.Worksheets(1).Cells.Find
(what:="the value is 2222")
If Not FoundCell Is Nothing Then
Else
End If
WB.Close SaveChanges:=True ' or False
FName = Dir()
Loop
End Sub