Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi all, I got names in column A of Workbooks("Summary.xls").Sheets
("Sheet1") like see below A .col John Vikki Ali Sophy Dean In folder "C:\Documents\Records" I have two files like see below Record for John Record for Sophy I want macro which should match names of column A with the file names and if exist then it should open that file. I wrote below macro which only opening file with name "Record of John" as it should also open "Record for Sophy" because the name Sophy also exist in column A list. Please can any friend help that whats wrong with macro below Sub Test() fldrName = "C:\Documents\Records" With Workbooks("Summary.xls").Sheets("Sheet1") lastcl = .Cells(Rows.Count, "A").End(xlUp).Row For RowCount = 2 To lastcl If .Range("A" & RowCount) < "" Then pnm = .Range("A" & RowCount).Value fName = Dir(fldrName & "\" & "*" & pnm & "*.xls") If fName = "" Then GoTo lastmsg Set bk = Workbooks.Open(Filename:=fldrName & "\" & fName) End If fName = Dir() Next End With lastmsg: MsgBox "Its Done!", vbInformation, "Done" End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
open / close files and display names | Excel Programming | |||
How to create a list of media files names in excel. | Excel Discussion (Misc queries) | |||
Excel 2003 - When I open files, why are some file names blue? | Excel Discussion (Misc queries) | |||
create a list of worksheet names (from a single folder, or open files) | Excel Discussion (Misc queries) | |||
Change names of files in a folder to match names in Excel Column | Excel Programming |