Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 576
Default 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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Importing data from multiple excel files chewy Excel Discussion (Misc queries) 2 April 20th 07 03:24 PM
Importing multiple files Tommy Excel Discussion (Misc queries) 1 February 19th 07 03:00 PM
Importing multiple files Joel Excel Discussion (Misc queries) 0 February 19th 07 11:46 AM
importing multiple .dat files! via135 Excel Worksheet Functions 0 March 29th 06 08:09 PM
Importing from multiple Excel files Tired of wasting time Excel Discussion (Misc queries) 2 September 21st 05 08:22 PM


All times are GMT +1. The time now is 09:08 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"