#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default Excel Merge

Hi All,
I have 4 csv report file with the following file name as follows :-
Interspec_CH_EOD_Report.csv
CHReport.csv
Interspec_HD_EOD_Report.csv
HDPending.csv

my query is I want all HDPending.csv data to be copied in
Interspec_HD_EOD_Report.csv file at the end of the row of

Interspec_HD_EOD_Report.csv file deleting the heading row from HDPending.csv
like for CHReport.csv also to be copied

to Interspec_CH_EOD_Report.csv file.
TIA
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Excel Merge

Make copies of all files before trying this code.

Sub Copyfiles()

Folder = "C:\Temp\"

Set HDPending = Workbooks.Open( _
Filename:=Folder & "Interspec_HD_EOD_Report.csv")

Set HDPending_Sht = HDPending.Sheets(1)

HDPending_LastRow = HDPending_Sht.Range("A" & Rows.Count).End(xlUp).Row

Set Interspec_HD = Workbooks.Open( _
Filename:=Folder & "Interspec_HD_EOD_Report.csv")

Set Interspec_HD_Sht = Interspec_HD.Sheets(1)

Interspec_HD_LastRow = Interspec_HD_Sht.Range("A" & Rows.Count).End(xlUp).Row

Interspec_HD_Sht.Rows("2:" & Interspec_HD_LastRow).Copy _
Destination:=HDPending_Sht.Rows(Interspec_HD_LastR ow + 1)

HDPending.Close Savechanges:=False
Interspec_HD.Close Savechanges:=True

Set HDPending = Nothing
Set HDPending_Sht = Nothing
Set Interspec_HD = Nothing
Set Interspec_HD_Sht = Nothing


Set CHReport = Workbooks.Open( _
Filename:=Folder & "CHReport.csv")

Set CHReport_Sht = CHReport.Sheets(1)

CHReport_LastRow = CHReport_Sht.Range("A" & Rows.Count).End(xlUp).Row

Set Interspec_CH = Workbooks.Open( _
Filename:=Folder & "Interspec_CH_EOD_Report.csv")

Set Interspec_CH_Sht = Interspec_CH.Sheets(1)

Interspec_CH_LastRow = Interspec_CH_Sht.Range("A" & Rows.Count).End(xlUp).Row

Interspec_CH_Sht.Rows("2:" & Interspec_CH_LastRow).Copy _
Destination:=CHReport_Sht.Rows(Interspec_CH_LastRo w + 1)

CHReport.Close Savechanges:=False
Interspec_CH.Close Savechanges:=True

End Sub






"kiran" wrote:

Hi All,
I have 4 csv report file with the following file name as follows :-
Interspec_CH_EOD_Report.csv
CHReport.csv
Interspec_HD_EOD_Report.csv
HDPending.csv

my query is I want all HDPending.csv data to be copied in
Interspec_HD_EOD_Report.csv file at the end of the row of

Interspec_HD_EOD_Report.csv file deleting the heading row from HDPending.csv
like for CHReport.csv also to be copied

to Interspec_CH_EOD_Report.csv file.
TIA

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default Excel Merge

Thanks Joel for your prompt replay but I'm getting object required at
Interspec_HD_Sht.Rows("2:" & Interspec_HD_LastRow).Copy _
Destination:=HDPending_Sht.Rows(Interspec_HD_LastR ow + 1)
line can u pls revert on this.
TIA


"Joel" wrote:

Make copies of all files before trying this code.

Sub Copyfiles()

Folder = "C:\Temp\"

Set HDPending = Workbooks.Open( _
Filename:=Folder & "Interspec_HD_EOD_Report.csv")

Set HDPending_Sht = HDPending.Sheets(1)

HDPending_LastRow = HDPending_Sht.Range("A" & Rows.Count).End(xlUp).Row

Set Interspec_HD = Workbooks.Open( _
Filename:=Folder & "Interspec_HD_EOD_Report.csv")

Set Interspec_HD_Sht = Interspec_HD.Sheets(1)

Interspec_HD_LastRow = Interspec_HD_Sht.Range("A" & Rows.Count).End(xlUp).Row

Interspec_HD_Sht.Rows("2:" & Interspec_HD_LastRow).Copy _
Destination:=HDPending_Sht.Rows(Interspec_HD_LastR ow + 1)

HDPending.Close Savechanges:=False
Interspec_HD.Close Savechanges:=True

Set HDPending = Nothing
Set HDPending_Sht = Nothing
Set Interspec_HD = Nothing
Set Interspec_HD_Sht = Nothing


Set CHReport = Workbooks.Open( _
Filename:=Folder & "CHReport.csv")

Set CHReport_Sht = CHReport.Sheets(1)

CHReport_LastRow = CHReport_Sht.Range("A" & Rows.Count).End(xlUp).Row

Set Interspec_CH = Workbooks.Open( _
Filename:=Folder & "Interspec_CH_EOD_Report.csv")

Set Interspec_CH_Sht = Interspec_CH.Sheets(1)

Interspec_CH_LastRow = Interspec_CH_Sht.Range("A" & Rows.Count).End(xlUp).Row

Interspec_CH_Sht.Rows("2:" & Interspec_CH_LastRow).Copy _
Destination:=CHReport_Sht.Rows(Interspec_CH_LastRo w + 1)

CHReport.Close Savechanges:=False
Interspec_CH.Close Savechanges:=True

End Sub






"kiran" wrote:

Hi All,
I have 4 csv report file with the following file name as follows :-
Interspec_CH_EOD_Report.csv
CHReport.csv
Interspec_HD_EOD_Report.csv
HDPending.csv

my query is I want all HDPending.csv data to be copied in
Interspec_HD_EOD_Report.csv file at the end of the row of

Interspec_HD_EOD_Report.csv file deleting the heading row from HDPending.csv
like for CHReport.csv also to be copied

to Interspec_CH_EOD_Report.csv file.
TIA

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Excel Merge

Looking at the code I think I opened the same workbook twice. tTy this change

from

Set HDPending = Workbooks.Open( _
Filename:=Folder & "Interspec_HD_EOD_Report.csv")

to

Set HDPending = Workbooks.Open( _
Filename:=Folder & "HDPending.csv")

Make sure you change the line with HDPending. The object wasn't found
because excel probably didn't open the workbook because it was already opend.


"kiran" wrote:

Thanks Joel for your prompt replay but I'm getting object required at
Interspec_HD_Sht.Rows("2:" & Interspec_HD_LastRow).Copy _
Destination:=HDPending_Sht.Rows(Interspec_HD_LastR ow + 1)
line can u pls revert on this.
TIA


"Joel" wrote:

Make copies of all files before trying this code.

Sub Copyfiles()

Folder = "C:\Temp\"

Set HDPending = Workbooks.Open( _
Filename:=Folder & "Interspec_HD_EOD_Report.csv")

Set HDPending_Sht = HDPending.Sheets(1)

HDPending_LastRow = HDPending_Sht.Range("A" & Rows.Count).End(xlUp).Row

Set Interspec_HD = Workbooks.Open( _
Filename:=Folder & "Interspec_HD_EOD_Report.csv")

Set Interspec_HD_Sht = Interspec_HD.Sheets(1)

Interspec_HD_LastRow = Interspec_HD_Sht.Range("A" & Rows.Count).End(xlUp).Row

Interspec_HD_Sht.Rows("2:" & Interspec_HD_LastRow).Copy _
Destination:=HDPending_Sht.Rows(Interspec_HD_LastR ow + 1)

HDPending.Close Savechanges:=False
Interspec_HD.Close Savechanges:=True

Set HDPending = Nothing
Set HDPending_Sht = Nothing
Set Interspec_HD = Nothing
Set Interspec_HD_Sht = Nothing


Set CHReport = Workbooks.Open( _
Filename:=Folder & "CHReport.csv")

Set CHReport_Sht = CHReport.Sheets(1)

CHReport_LastRow = CHReport_Sht.Range("A" & Rows.Count).End(xlUp).Row

Set Interspec_CH = Workbooks.Open( _
Filename:=Folder & "Interspec_CH_EOD_Report.csv")

Set Interspec_CH_Sht = Interspec_CH.Sheets(1)

Interspec_CH_LastRow = Interspec_CH_Sht.Range("A" & Rows.Count).End(xlUp).Row

Interspec_CH_Sht.Rows("2:" & Interspec_CH_LastRow).Copy _
Destination:=CHReport_Sht.Rows(Interspec_CH_LastRo w + 1)

CHReport.Close Savechanges:=False
Interspec_CH.Close Savechanges:=True

End Sub






"kiran" wrote:

Hi All,
I have 4 csv report file with the following file name as follows :-
Interspec_CH_EOD_Report.csv
CHReport.csv
Interspec_HD_EOD_Report.csv
HDPending.csv

my query is I want all HDPending.csv data to be copied in
Interspec_HD_EOD_Report.csv file at the end of the row of

Interspec_HD_EOD_Report.csv file deleting the heading row from HDPending.csv
like for CHReport.csv also to be copied

to Interspec_CH_EOD_Report.csv file.
TIA

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default Excel Merge

Thanks Joel

"Joel" wrote:

Looking at the code I think I opened the same workbook twice. tTy this change

from

Set HDPending = Workbooks.Open( _
Filename:=Folder & "Interspec_HD_EOD_Report.csv")

to

Set HDPending = Workbooks.Open( _
Filename:=Folder & "HDPending.csv")

Make sure you change the line with HDPending. The object wasn't found
because excel probably didn't open the workbook because it was already opend.


"kiran" wrote:

Thanks Joel for your prompt replay but I'm getting object required at
Interspec_HD_Sht.Rows("2:" & Interspec_HD_LastRow).Copy _
Destination:=HDPending_Sht.Rows(Interspec_HD_LastR ow + 1)
line can u pls revert on this.
TIA


"Joel" wrote:

Make copies of all files before trying this code.

Sub Copyfiles()

Folder = "C:\Temp\"

Set HDPending = Workbooks.Open( _
Filename:=Folder & "Interspec_HD_EOD_Report.csv")

Set HDPending_Sht = HDPending.Sheets(1)

HDPending_LastRow = HDPending_Sht.Range("A" & Rows.Count).End(xlUp).Row

Set Interspec_HD = Workbooks.Open( _
Filename:=Folder & "Interspec_HD_EOD_Report.csv")

Set Interspec_HD_Sht = Interspec_HD.Sheets(1)

Interspec_HD_LastRow = Interspec_HD_Sht.Range("A" & Rows.Count).End(xlUp).Row

Interspec_HD_Sht.Rows("2:" & Interspec_HD_LastRow).Copy _
Destination:=HDPending_Sht.Rows(Interspec_HD_LastR ow + 1)

HDPending.Close Savechanges:=False
Interspec_HD.Close Savechanges:=True

Set HDPending = Nothing
Set HDPending_Sht = Nothing
Set Interspec_HD = Nothing
Set Interspec_HD_Sht = Nothing


Set CHReport = Workbooks.Open( _
Filename:=Folder & "CHReport.csv")

Set CHReport_Sht = CHReport.Sheets(1)

CHReport_LastRow = CHReport_Sht.Range("A" & Rows.Count).End(xlUp).Row

Set Interspec_CH = Workbooks.Open( _
Filename:=Folder & "Interspec_CH_EOD_Report.csv")

Set Interspec_CH_Sht = Interspec_CH.Sheets(1)

Interspec_CH_LastRow = Interspec_CH_Sht.Range("A" & Rows.Count).End(xlUp).Row

Interspec_CH_Sht.Rows("2:" & Interspec_CH_LastRow).Copy _
Destination:=CHReport_Sht.Rows(Interspec_CH_LastRo w + 1)

CHReport.Close Savechanges:=False
Interspec_CH.Close Savechanges:=True

End Sub






"kiran" wrote:

Hi All,
I have 4 csv report file with the following file name as follows :-
Interspec_CH_EOD_Report.csv
CHReport.csv
Interspec_HD_EOD_Report.csv
HDPending.csv

my query is I want all HDPending.csv data to be copied in
Interspec_HD_EOD_Report.csv file at the end of the row of

Interspec_HD_EOD_Report.csv file deleting the heading row from HDPending.csv
like for CHReport.csv also to be copied

to Interspec_CH_EOD_Report.csv file.
TIA

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 two excel files like in word mail merge azmerritt Excel Discussion (Misc queries) 1 December 11th 16 09:23 PM
Mail merge macro: select recipients from Excel during merge Worksmart Excel Programming 0 May 18th 08 06:37 PM
Trying to merge from excel to word. New names won't merge ruth tozer Excel Worksheet Functions 0 June 27th 07 05:58 AM
mail merge excludes my headers and critical data in Word merge Nix Excel Discussion (Misc queries) 0 April 21st 06 08:35 PM
Can I merge an excel list to an excel sheet like mail merge in wor chcoach Excel Programming 0 March 7th 06 07:09 PM


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