I wasn't able to test it due to the amount of work that would be involved in replicating your situation, but try this code to see if it works:
Private Sub CommandButton4_Click()
Dim Ump As String
Dim Mns As String
Dim Pth As String
Dim Mnt As String
Dim Fln As String
Dim Wkb As Workbook
Dim Wks As Worksheet
Dim Rng As Range
Dim c As Range
Dim i As Long
Ump = Application.InputBox(Prompt:="Please Enter Cheque Date", Type:=1)
Mnt = Month(Ump)
Range("E54").Value = Mnt
Mns = Range("F54").Value
Pth = "Q:\CRS PAID FILE (Lai-Yin)\2008\" & Range("D42").Value & "_" & Mns
Set Wks = ActiveSheet
i = 87
With Wks
While .Cells(i, 5) <> "End"
Fln = .Cells(i, 5).Value
ChDir Pth
Set Wkb = Workbooks.Open(Filename:= _
Pth & "\" & Fln)
If Not Wkb Is Nothing Then
Set Rng = Wkb.ActiveSheet.Columns("F:F")
Set c = Rng.Find(What:="GE FLEET SERVICES", After:=Rng.Resize(1, 1). _
Offset(0, -1), LookIn:=xlFormulas, LookAt:=xlWhole, _
SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, _
SearchFormat:=False)
If c Is Nothing Then Wkb.Close
c.Activate
Exit Sub
End If
i = i + 1
Wend
End With
End Sub
Jason
Bookmarks