PC Review


Reply
Thread Tools Rate Thread

Copy worsheet from different files in to one file

 
 
Boss
Guest
Posts: n/a
 
      14th Apr 2008
Hi,

The situation is, I have 25 excel files in my C:/ drive.

I need to copy first worksheet named as "Fullrecon" from all 25 excel files
into one excel file.

In the new file, the data from the 25 excel sheets should come in one single
worksheet.

In other words if each of 25 excel sheets contain 100 rows then the final
excel sheets should contain 2500 rows.

This task is very important for me. I am not so good at coding. Please help
me achieve this. Thanks a lot for the help.

Thanks
Boss

 
Reply With Quote
 
 
 
 
Joel
Guest
Posts: n/a
 
      14th Apr 2008
Sub combine()

Folder = "c:\temp"
First = True
Do
If First = True Then
FName = Dir(Folder & "\*.xls")
First = False
Else
FName = Dir()
End If
If FName <> "" Then
Workbooks.Open Filename:=Folder & "\" & FName
Set newbk = ActiveWorkbook

With ThisWorkbook.ActiveSheet
LastRow = .Range("A" & Rows.Count).End(xlUp).Row
NewRow = LastRow + 1
End With

With newbk.Sheets("Fullrecon")
NewLastRow = .Range("A" & Rows.Count).End(xlUp).Row
.Rows("1:" & NewLastRow).Copy _
Destination:=ThisWorkbook.ActiveSheet.Rows(NewRow)
End With
newbk.Close
End If
Loop While FName <> ""
End Sub


"Boss" wrote:

> Hi,
>
> The situation is, I have 25 excel files in my C:/ drive.
>
> I need to copy first worksheet named as "Fullrecon" from all 25 excel files
> into one excel file.
>
> In the new file, the data from the 25 excel sheets should come in one single
> worksheet.
>
> In other words if each of 25 excel sheets contain 100 rows then the final
> excel sheets should contain 2500 rows.
>
> This task is very important for me. I am not so good at coding. Please help
> me achieve this. Thanks a lot for the help.
>
> Thanks
> Boss
>

 
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
Copy worsheet from different files in to one file Boss Microsoft Excel Programming 3 11th Feb 2008 01:06 PM
Enter data in one worksheet and have it copy to another worsheet =?Utf-8?B?SmltRw==?= Microsoft Excel Misc 0 13th Sep 2007 01:50 AM
Split Large CSV excel file into two files or worsheet tarone@gmail.com Microsoft Access 7 1st Jan 2007 11:54 AM
Divide worsheet and save as separate files Colin Hayes Microsoft Excel Worksheet Functions 0 28th Jun 2005 09:42 PM
Copy a range from different worksheets and place in another worsheet unplugs Microsoft Excel Programming 1 5th Jul 2004 03:51 AM


Features
 

Advertising
 

Newsgroups
 


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