Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default importing data from multiple excel spreadsheets

I need assistance in creating code that will open excel spreadsheets
import data into an array, then close the file. I'm not sure how to d
the opening and importing part and I need to see some examples.

We have a program from Avaya called CMS that lets us monitor differen
bits of data for the techs at hour tech support help desk.
When we want to run reports on our teams, we have scripts tha
interface with CMS and generate Excel spreadsheets of each technician'
current stats.
We then have to open all of the spreadsheets at once, then open anothe
spreadsheet that reads the data, performs the calculations needed t
average the data, then displays it all in a nice little layout tha
shows all the info properly sorted.

The main issue is that this is a pain in the @ss. Its cumbersome an
slow.

What I would like to do is add in some VB code that will open eac
spreadsheet being generated by CMS, import the important data, the
close the spreadsheet. Once all the info is stored in a couple o
arrays, the VB code will then do its normal calculations and displa
the info.

Thanks for any help

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default importing data from multiple excel spreadsheets

How are the workbooks to open determined?

Are they all in one directory and all files in that directory should be
opened?
Assume the above
Dim sPath as String, sName as String
Dim i as Long, j as Long, sStr as String
Dim wkbk as Workbook
Dim vArr as Variant

sPath = "C:\MyFiles\
sName = Dir(sPath & "*.xls")
do while sName < ""
sStr = sName & vbNewLine & vbNewLine
set wkbk = workbooks.Open(sPath & sName)
vArr = wkbk.Worksheets(1).Range("A1:B20").Value
for i = 1 to 2
for j = 1 to 20
sStr = sStr & varr(i,j) & ","
next j
sStr = sStr & vbNewLine
Next i
msgbox sStr
wkbk.Close Savechanges:=False
sName = dir()
Loop

untested (may contain typos), but represents an approach

--
Regards,
Tom Ogilvy

"Geuis " wrote in message
...
I need assistance in creating code that will open excel spreadsheets,
import data into an array, then close the file. I'm not sure how to do
the opening and importing part and I need to see some examples.

We have a program from Avaya called CMS that lets us monitor different
bits of data for the techs at hour tech support help desk.
When we want to run reports on our teams, we have scripts that
interface with CMS and generate Excel spreadsheets of each technician's
current stats.
We then have to open all of the spreadsheets at once, then open another
spreadsheet that reads the data, performs the calculations needed to
average the data, then displays it all in a nice little layout that
shows all the info properly sorted.

The main issue is that this is a pain in the @ss. Its cumbersome and
slow.

What I would like to do is add in some VB code that will open each
spreadsheet being generated by CMS, import the important data, then
close the spreadsheet. Once all the info is stored in a couple of
arrays, the VB code will then do its normal calculations and display
the info.

Thanks for any help.


---
Message posted from http://www.ExcelForum.com/



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 EXCEL Spreadsheets into ACCESS -- Macro or VBA? Excel Worksheet Functions 0 July 12th 06 10:08 PM
How do I link data between multiple excel spreadsheets Scott Excel Discussion (Misc queries) 0 May 8th 06 07:28 PM
Importing Excel spreadsheets Mike Excel Discussion (Misc queries) 0 November 28th 05 02:30 PM
Importing from access database into multiple spreadsheets Sandy Excel Discussion (Misc queries) 1 September 8th 05 03:55 AM


All times are GMT +1. The time now is 10:23 AM.

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"