Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Transferring Data from Multiple Excel files to single excel files.

I have multiple excel data files e.g. a.xls, b.xls, c.xls, etc. & one master
data file.

a, b, c, etc are in one directory & master data is in another directory.
Also sometime I may have only a & c file available but no file b. How do i
transfer the data from a, b, c, etc to master data file without opening any
one of them. I know it can be done with ado connect. but i'm lost with
codings.

Please advise.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Transferring Data from Multiple Excel files to single excel files.

Hi Sunil

Start here
http://www.rondebruin.nl/ado.htm

But I like the add-in or code examples at the top of the page that opne the workbook
Much more control then

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm




"Sunil Pradhan" wrote in message ...
I have multiple excel data files e.g. a.xls, b.xls, c.xls, etc. & one master
data file.

a, b, c, etc are in one directory & master data is in another directory.
Also sometime I may have only a & c file available but no file b. How do i
transfer the data from a, b, c, etc to master data file without opening any
one of them. I know it can be done with ado connect. but i'm lost with
codings.

Please advise.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Transferring Data from Multiple Excel files to single excel files.

Here is some code that will import data from another worksheet on another
workbook. Note that you will need to put a click box somewhere on one of the
sheets of the workbook (NOT the sheet you want to import the data to) in
order to activate the this code.

Sub ImportData()

Sheets("SHEET1").Activate
Response = MsgBox("Are you sure you want to do this?" & Chr(13) & "This will
delete any current data on this worksheet", vbYesNo)
If Response = vbNo Then Exit Sub
Range("A1").Select
Filename = Application.InputBox(Prompt:="Enter the EXACT File Name of the
workbook you wish" & Chr(13) & "to import from the ExcelDATA folder on the S
drive: ", Type:=2)

With ActiveSheet.QueryTables.Add(Connection:=Array( _
"OLEDB;Provider=Microsoft.Jet.OLEDB.4.0;Password=" """;User
ID=Admin;Data Source=S:\ExcelDATA\" & Filename & ".xls;M" _
, _
"ode=Share Deny Write;Extended Properties=""HDR=YES;"";Jet
OLEDB:System database="""";Jet OLEDB:Registry Path="""";Jet OLEDB:Database P"
_
, _
"assword="""";Jet OLEDB:Engine Type=35;Jet OLEDB:Database Locking
Mode=0;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk " _
, _
"Transactions=1;Jet OLEDB:New Database Password="""";Jet
OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;Jet OL" _
, _
"EDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without
Replica Repair=False;Jet OLEDB:SFP=False" _
), Destination:=Range("A1"))
.CommandType = xlCmdTable
.CommandText = Array("SHEET1$A1:AA10000")
.Name = Filename
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = False
.AdjustColumnWidth = False
.RefreshPeriod = 0
.PreserveColumnInfo = True
.SourceDataFile = "S:\ExcelDATA\" & Filename & ".xls"
.Refresh BackgroundQuery:=False
.MaintainConnection = False
End With
End Sub

"Sunil Pradhan" wrote:

I have multiple excel data files e.g. a.xls, b.xls, c.xls, etc. & one master
data file.

a, b, c, etc are in one directory & master data is in another directory.
Also sometime I may have only a & c file available but no file b. How do i
transfer the data from a, b, c, etc to master data file without opening any
one of them. I know it can be done with ado connect. but i'm lost with
codings.

Please advise.

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
Merge Multiple Single Worksheet Excel Files into one file in separ dbguy11 Excel Discussion (Misc queries) 6 April 3rd 23 04:20 PM
Export Excel data as multiple files K Excel Discussion (Misc queries) 5 October 31st 08 09:31 PM
Gather data from multiple excel files into one master excel file Mark Allen Excel Discussion (Misc queries) 18 September 9th 08 01:06 PM
How to import multiple csv files in single excel file automaticall D Joshi Excel Programming 1 March 17th 08 03:27 PM
Extracting data from multiple excel files. helphelp Excel Discussion (Misc queries) 2 May 10th 06 09:45 PM


All times are GMT +1. The time now is 12:39 PM.

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

About Us

"It's about Microsoft Excel"