Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default merging two files

I have two files that have the same format and I am trying to merge them
into one spreadsheet. I have to import both files from a CSV format.
When I import both of them into the same sheet, now, I try two bring
them into (A1). I want them in the same columns but when i bring the
second file in it pushes the first file over to the right instead of
down. Is there a way to merge these sheets to the same columns.

Thank you for any suggestions

Morry


---
Message posted from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default merging two files

in the command window (or use the shell command)

copy a.csv + b.csv c.csv


then import c.csv




otherwise do your import for the first at A1 and you inport for the second
at

cells(rows.count,1).end(xlup)(2)


--
Regards,
Tom Ogilvy

"morry " wrote in message
...
I have two files that have the same format and I am trying to merge them
into one spreadsheet. I have to import both files from a CSV format.
When I import both of them into the same sheet, now, I try two bring
them into (A1). I want them in the same columns but when i bring the
second file in it pushes the first file over to the right instead of
down. Is there a way to merge these sheets to the same columns.

Thank you for any suggestions

Morry


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default merging two files

Thanks for the help Tom. But I have another question. I am using th
macro recorder to import the external data and macros usually give m
more code than I really need to perform the function. I am not exactl
sure how to insert the piece of code you gave me, into the macro code
When I created the macro I scrolled down to the end of the first fil
and inserted the second file. I listed the pertinent code segmen
below.
The code you gave me was: cells(rows.count,1).end(xlup)(2)
I tried a couple different ways to replace this with the range but i
wouldn't work. Could you please tell me how to use this code.

Thank you very much,

Morr

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default merging two files

I listed the pertinent code segment
below.

No you didn't. Can't do much without it.

--
Regards,
Tom Ogilvy

"morry " wrote in message
...
Thanks for the help Tom. But I have another question. I am using the
macro recorder to import the external data and macros usually give me
more code than I really need to perform the function. I am not exactly
sure how to insert the piece of code you gave me, into the macro code.
When I created the macro I scrolled down to the end of the first file
and inserted the second file. I listed the pertinent code segment
below.
The code you gave me was: cells(rows.count,1).end(xlup)(2)
I tried a couple different ways to replace this with the range but it
wouldn't work. Could you please tell me how to use this code.

Thank you very much,

Morry


---
Message posted from http://www.ExcelForum.com/



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default merging two files

I'm sorry Tom, I went and copied it but I forgot to paste it to thi
message. I listed it below this time.

Range("A2322").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\Documents and Settings\rg42735\Desktop\Monthl
Reports\Work in Progres
Report\MonthlyReportCSVs\CA\URLTemplateAction." _
, Destination:=Range("A2322"))
.Name = "URLTemplateAction._6"


Thank you,

Morr

--
Message posted from http://www.ExcelForum.com



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default merging two files

I would try:

Activesheet.End(xlup)(2).Select
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\Documents and Settings\rg42735\Desktop\Monthly
Reports\Work in Progress
Report\MonthlyReportCSVs\CA\URLTemplateAction." _
, Destination:=Selection)
Name = "URLTemplateAction._6"

--
Regards,
Tom Ogilvy

"morry " wrote in message
...
I'm sorry Tom, I went and copied it but I forgot to paste it to this
message. I listed it below this time.

Range("A2322").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\Documents and Settings\rg42735\Desktop\Monthly
Reports\Work in Progress
Report\MonthlyReportCSVs\CA\URLTemplateAction." _
, Destination:=Range("A2322"))
Name = "URLTemplateAction._6"


Thank you,

Morry


---
Message posted from http://www.ExcelForum.com/



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default merging two files

I tried this code but it gives me a Run time error 438. "Object doesn'
support this property or method. Do you know why this would be? I
there any other way to accomplish this task that you may know of?

Thank you for all your help

Morr

--
Message posted from http://www.ExcelForum.com

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default merging two files

Does anyone know how to alter this so I can import two files onto th
same sheet and same columns. I have been altering this code all da
and it only shifts the code to the right it's driving me crazy. I
anyone has any ideas please let me know.
Here is what I have.
-----------------------------------------------------------------------------------
Sub Macro4()

With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\Documents and Settings\rg5\Desktop\Monthl
Reports\Work in Progres
Report\MonthlyReportCSVs\ECN\URLTemplateAction." _
, Destination:=Range("A1"))
.Name = "URLTemplateAction._5"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = xlWindows
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = False
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = True
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1)
.Refresh BackgroundQuery:=False
End With
Rows("1:6").Select
Selection.Delete Shift:=xlUp
Columns("B:B").Select
Selection.Insert Shift:=xlToRight
Application.Rows.End(xlUp).Select
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\Documents and Settings\rg5\Desktop\Monthl
Reports\Work in Progres
Report\MonthlyReportCSVs\CA\URLTemplateAction." _
, Destination:=Selection)
.Name = "URLTemplateAction._6"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = xlWindows
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = False
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = True
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1)
.Refresh BackgroundQuery:=False
End With
End Sub
------------------------------------------------------------------------------------
Thank you

Morry :confused

--
Message posted from http://www.ExcelForum.com

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
Merging 2 files Distribution list - Contacts Module Excel Discussion (Misc queries) 1 October 25th 08 02:48 AM
merging zip files! via135 Excel Discussion (Misc queries) 2 November 19th 06 05:32 PM
merging two files mcap Excel Discussion (Misc queries) 3 April 9th 06 07:28 PM
Merging two different files justinfisher Excel Discussion (Misc queries) 0 January 21st 05 08:53 PM
Merging Files rglasunow[_13_] Excel Programming 3 February 3rd 04 01:27 AM


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