![]() |
Importing Multiple Data Files
Tom,
This is a complicated form that I use with folder names, file names,division numbers, and passwords in different columns. You can replace the Index functions with fldr = Cells(xx,1) where your list is in column A and starts on row 1 the rest is just extra stuff to confuse you... (and maybe give you some ideas?) steve For xx = 1 To xxx ' xxx = # of divisions ' complete path w/file name fldr = WorksheetFunction.Index(Workbooks(mainbook).Sheets ("sheet1").Range("division s"), xx, 1) ' password pass = WorksheetFunction.Index(Workbooks(mainbook).Sheets ("sheet1").Range("pass"), xx, 1) ' file name files = WorksheetFunction.Index(Workbooks(mainbook).Sheets ("sheet1").Range("files"), xx, 1) ' sheet(1).name divsheet = WorksheetFunction.Index(Workbooks(mainbook).Sheets ("sheet1").Range("div_shee ts"), xx, 1) ' division divnum = WorksheetFunction.Index(Workbooks(mainbook).Sheets ("sheet1").Range("div_numb er"), xx, 1) If fldr = "" Then GoTo lineNext End If On Error GoTo lineFileOpenError Workbooks.Open FileName:=fldr, password:=pass Next "Tom Arcati" wrote in message ... I have been trying to write a macro that will open several data files (Tab seperated variables) and put them in several worksheets within one workbook. This allows all data to be compiled and graphed. I can only get this to work if I "hard code" the data file path and name in the macro. This is not what I need or can use. What I want to do is have the file name defined in a cell and have the macro get the file name from there. This would allow the user enter the files he needs to bring into the workbook. I could not find any infomation for this in the help files. Help please! Tom |
All times are GMT +1. The time now is 07:20 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com