PC Review


Reply
Thread Tools Rate Thread

Combining Data from Multiple Closed Files in Folder

 
 
Monk
Guest
Posts: n/a
 
      30th Jul 2009
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 With Quote
 
 
 
 
Jim Cone
Guest
Posts: n/a
 
      30th Jul 2009

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" <(E-Mail Removed)>
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 With Quote
 
Monk
Guest
Posts: n/a
 
      30th Jul 2009
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" <(E-Mail Removed)>
> 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Extracting data on multiple files from one folder Pawan Microsoft Excel Programming 11 8th Nov 2009 02:36 PM
Print from multiple closed files in a folder b1llt Microsoft Excel Programming 0 22nd Oct 2009 06:54 PM
Import data from multiple excel files in one folder WingZero Microsoft Excel Programming 7 13th Dec 2007 07:30 PM
Extract cell data from multiple files in one folder =?Utf-8?B?c21vbnNtbw==?= Microsoft Excel Misc 3 17th Aug 2007 11:16 PM
RE: combining multiple columns from multiple files =?Utf-8?B?RXhjZWxOb3ZpY2U=?= Microsoft Excel Misc 0 17th Jan 2007 03:30 AM


Features
 

Advertising
 

Newsgroups
 


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