Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi all, I have name in column A like see below
A ..col Denise Buky John Well Sophy Bell and I have files in folder "C:\Record" like see below Record Sheet - Denise Buky.xls Record - Roy William.xls Record (John Well).xls Record Sheet Craig Brown.xls Record - Sophy Bell.xls Record Sheet - Dean Owen.xls I need macro which should check names in column A and only open those files from above folder in which that name match or appear. I tried doing this with below macro but this opens up all the files in folder. Please can any friend can help that how can i do it. Sub test() fldrName = "C:\Record" fName = Dir(fldrName & "\*.xls") lastcl = Workbooks("Data.xls").Sheets("Sheet1").Cells(Rows. Count, "A").End(xlUp).Row Do While fName < "" Set c = Workbooks("Data.xls").Sheets("Sheet1").Range("A2:A " & lastcl).Find(What:=fName, _ LookIn:=xlValues, LookAt:=xlWhole) If c Is Nothing Then Set bk = Workbooks.Open(Filename:=fldrName & "\" & fName) bk.Close False End If fName = Dir() Loop End Sub |
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 |