Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Again
First off sorry my first code didn't work for you, not sure why as i tested it and it runs fine for me with the info from your post? Anywho i can't think of a way around it using your proposed method however i have come up with a sort of combo of the two, this time without the FSO but still using the InStr function as i think this is the easiest way to check for a name in a string... I have added a few escape routes to try and get out of the loops to prevent unnecessary cycles, let me know how you get on with the code and of course if you find a way around the problem :) Dim fldrName As String Dim fName Dim lastcl As Integer Dim i As Integer Dim intFound As Integer Sub test() fldrName = "C:\Record" fName = Dir(fldrName & "\*.xls") With Workbooks("Data.xls") lastcl = .Sheets("Sheet1").Cells _ (Rows.Count, "A").End(xlUp).Row Do While fName < "" For i = 1 To lastcl If InStr(1, fName, .ActiveSheet.Cells(i, 1).Value, _ vbTextCompare) < 0 Then Workbooks.Open (fldrName & "\" & fName) intFound = intFound + 1 i = lastcl End If Next i fName = Dir() If intFound = lastcl Then Exit Do Loop End With End Sub Steve |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
User selection of folder and open all .xls files within folder | Excel Programming | |||
Open all files in folder automatically using VBA | Excel Programming | |||
Open files in folder - skip if already open | Excel Programming | |||
Open all files in a folder | Excel Programming | |||
open all files in a folder and ... | Excel Programming |