Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default Combining Data from Multiple Closed Files in Folder

I am attempting to combine data into one excel file from multiple csv files
which are all stored in the same folder. As the csv data is all on the first
sheet of each file, I just want to paste the data from each file into the
first sheet of an excel file called Master.xls. The data can just be pasted
into the next blank cell.

I am attempting to run the following code from Ron De Bruin but I get a
Compile Error Sub or function not defined warning on Get_File_Names. Any
suggestions as to my error would be appreciated.

Sub RDB_Merge_Data()
Dim myFiles As Variant
Dim myCountOfFiles As Long

myCountOfFiles = Get_File_Names( _
MyPath:="F:\Home\Paul\Test", _
Subfolders:=False, _
ExtStr:="*.csv", _
myReturnedFiles:=myFiles)

If myCountOfFiles = 0 Then
MsgBox "No files that match the ExtStr in this folder"
Exit Sub
End If

Get_Data _
FileNameInA:=True, _
PasteAsValues:=True, _
SourceShName:="", _
SourceShIndex:=1, _
SourceRng:="A:G", _
StartCell:="", _
myReturnedFiles:=myFiles

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default Combining Data from Multiple Closed Files in Folder


Looks like you didn't copy all of the code.
It appears there is a Function called Get_File_Names and
a Sub called Get_Data that you would need to add to your module.
--
Jim Cone
Portland, Oregon USA



"Monk"
wrote in message
I am attempting to combine data into one excel file from multiple csv files
which are all stored in the same folder. As the csv data is all on the first
sheet of each file, I just want to paste the data from each file into the
first sheet of an excel file called Master.xls. The data can just be pasted
into the next blank cell.

I am attempting to run the following code from Ron De Bruin but I get a
Compile Error Sub or function not defined warning on Get_File_Names. Any
suggestions as to my error would be appreciated.

Sub RDB_Merge_Data()
Dim myFiles As Variant
Dim myCountOfFiles As Long

myCountOfFiles = Get_File_Names( _
MyPath:="F:\Home\Paul\Test", _
Subfolders:=False, _
ExtStr:="*.csv", _
myReturnedFiles:=myFiles)

If myCountOfFiles = 0 Then
MsgBox "No files that match the ExtStr in this folder"
Exit Sub
End If

Get_Data _
FileNameInA:=True, _
PasteAsValues:=True, _
SourceShName:="", _
SourceShIndex:=1, _
SourceRng:="A:G", _
StartCell:="", _
myReturnedFiles:=myFiles

End Sub
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default Combining Data from Multiple Closed Files in Folder

Thanks. My mistake. All resolved.

"Jim Cone" wrote:


Looks like you didn't copy all of the code.
It appears there is a Function called Get_File_Names and
a Sub called Get_Data that you would need to add to your module.
--
Jim Cone
Portland, Oregon USA



"Monk"
wrote in message
I am attempting to combine data into one excel file from multiple csv files
which are all stored in the same folder. As the csv data is all on the first
sheet of each file, I just want to paste the data from each file into the
first sheet of an excel file called Master.xls. The data can just be pasted
into the next blank cell.

I am attempting to run the following code from Ron De Bruin but I get a
Compile Error Sub or function not defined warning on Get_File_Names. Any
suggestions as to my error would be appreciated.

Sub RDB_Merge_Data()
Dim myFiles As Variant
Dim myCountOfFiles As Long

myCountOfFiles = Get_File_Names( _
MyPath:="F:\Home\Paul\Test", _
Subfolders:=False, _
ExtStr:="*.csv", _
myReturnedFiles:=myFiles)

If myCountOfFiles = 0 Then
MsgBox "No files that match the ExtStr in this folder"
Exit Sub
End If

Get_Data _
FileNameInA:=True, _
PasteAsValues:=True, _
SourceShName:="", _
SourceShIndex:=1, _
SourceRng:="A:G", _
StartCell:="", _
myReturnedFiles:=myFiles

End Sub

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
Import data from multiple excel files in one folder WingZero Excel Programming 7 December 13th 07 07:30 PM
Extract cell data from multiple files in one folder smonsmo Excel Discussion (Misc queries) 3 August 17th 07 11:16 PM
Combining multiple files in Excel [email protected] Excel Worksheet Functions 1 June 21st 07 07:45 PM
combining multiple columns from multiple files osiris73 Excel Discussion (Misc queries) 2 January 17th 07 03:30 AM
"Folder Select" Dialogue - Opening multiple files from selected folder Rob[_26_] Excel Programming 2 September 30th 05 02:47 PM


All times are GMT +1. The time now is 03:39 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"