How to make one CSV file from two Excel sheets?

I have a huge database with about 400 columns. They are divided into two 
sheets - due to Excel limitation 256 columns in one sheet.

I need to make one CSV file from these both sheets. The last column of first 
sheet should be followed by the first column of the second sheet.

Is there any way how to do it directly from Excel? Or do you know any simple 
utility that can put together two CSV files exported from Excel?

Thanks for any help

Marek L.
0
Utf
2/12/2005 11:35:04 PM
excel.misc 78881 articles. 5 followers. Follow

3 Replies
361 Views

Similar Articles

[PageSpeed] 45

That sort of stiching can only be done using a hex editor. (And not all
hex editors are created equal.)  I did a quick search on the web and
there are free editors out there, but I don't know if they are any
good.  Its been 10 years since I used one.


-- 
nbrcrunch
0
2/13/2005 6:15:17 AM
J.E. McGimpsey has some nice code to create text files at:
http://mcgimpsey.com/excel/textfiles.html

Chip Pearson has some more nice code at:
http://www.cpearson.com/excel/imptext.htm

This example just adds commas between each field.  This may not be exactly what
you need (double quotes around some strings/values formatted as date/time???).

But it may get you started:

Option Explicit

Sub testme01()

    Dim myRecord As Range
    Dim myField As Range
    Dim nFileNum As Long
    Dim sOut1 As String
    Dim sOut2 As String
    Dim wks1 As Worksheet
    Dim wks2 As Worksheet
    
    Dim myCell As Range
    
    Dim iRow As Long
    Dim LastRow1 As Long
    Dim LastRow2 As Long
    Dim LastCol1 As Long
    Dim LastCol2 As Long
    Dim FirstRow As Long
    
    Set wks1 = Worksheets("sheet1")
    Set wks2 = Worksheets("sheet2")
    
    With wks1
        LastRow1 = .Cells(.Rows.Count, "A").End(xlUp).Row
    End With
 
    With wks2
        LastRow2 = .Cells(.Rows.Count, "A").End(xlUp).Row
    End With
    
    If LastRow1 <> LastRow2 Then
        MsgBox "Rows don't match!"
        Exit Sub
    End If
    
    'adjust to match your data
    FirstRow = 1    'common first row
    LastCol1 = 256  'last column of wks1
    LastCol2 = 10   'last column of wks2
        
    nFileNum = FreeFile
    Open "c:\File1.txt" For Output As #nFileNum
    
    For iRow = FirstRow To LastRow1
        sOut1 = ""
        sOut2 = ""
        With wks1
            For Each myCell In .Range(.Cells(iRow, "A"), .Cells(iRow, LastCol1))
                sOut1 = sOut1 & "," & myCell.Value
            Next myCell
        End With
        sOut1 = Mid(sOut1, 2)
        With wks2
            For Each myCell In .Range(.Cells(iRow, "A"), .Cells(iRow, LastCol2))
                sOut2 = sOut2 & "," & myCell.Value
            Next myCell
        End With
        sOut2 = Mid(sOut2, 2)
            
        Print #nFileNum, sOut1 & sOut2
        
    Next iRow
    Close #nFileNum
End Sub




Marek L. wrote:
> 
> I have a huge database with about 400 columns. They are divided into two
> sheets - due to Excel limitation 256 columns in one sheet.
> 
> I need to make one CSV file from these both sheets. The last column of first
> sheet should be followed by the first column of the second sheet.
> 
> Is there any way how to do it directly from Excel? Or do you know any simple
> utility that can put together two CSV files exported from Excel?
> 
> Thanks for any help
> 
> Marek L.

-- 

Dave Peterson
0
ec357201 (5290)
2/13/2005 1:32:04 PM
Choose save as option from file menu and choose Excel CSV format from file 
menu type a file name and save it

Kerala Ayurveda Treatments
www.ayurvedatreatements.net
Ayurveda- A natural way to perfect health.

mail@ayurvedatreatments.net


"Marek L." wrote:

> I have a huge database with about 400 columns. They are divided into two 
> sheets - due to Excel limitation 256 columns in one sheet.
> 
> I need to make one CSV file from these both sheets. The last column of first 
> sheet should be followed by the first column of the second sheet.
> 
> Is there any way how to do it directly from Excel? Or do you know any simple 
> utility that can put together two CSV files exported from Excel?
> 
> Thanks for any help
> 
> Marek L.
0
2/13/2005 7:47:02 PM
Reply:

Similar Artilces:

Excel 2007
When I select cells to copy as a picture in Excel 2007, the resolution is terrible. Text and objects with shadow's are very blotchy when pasting the picture. How do you change the resolution of a 'Copy Picture'? ...

Sort ascending, make changes, restore previous order
I've got an AutoFilter in a spreadsheet. I want to sort ascending, mak some changes to some cells, then restore the previous order. Can thi be done easily or will this require some programming?? Thanks in advane! Matt -- BVHi ----------------------------------------------------------------------- BVHis's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=859 View this thread: http://www.excelforum.com/showthread.php?threadid=47508 I'd use a helper column. Put =row() and drag down. Convert it to values (edit|copy, edit|paste special|values) Do all y...

Input Excel 'Password to Open' through control in access form
Hi All, We know,Excel has prompt password to open it files. Is it possible to create a code that can supplies the excel prompt password?.So that when we open the excel file through our access control in a form, the excel files can be opened automatically.But when the excel files opened from its default icon,it will prompt a password first. ...

Parsing data from one spreadsheet into another format
The data that we dump out of one machine comes in like below. %AT_1300 Bottoms|Conductivity| (Water Out) InputRange VDC1to5 %AT_1300 Bottoms|Conductivity| (Water Out) Custom_Range_Low 0.0 %AT_1300 Bottoms|Conductivity| (Water Out) Custom_Range_Hi 0.0 %AT_1300 Bottoms|Conductivity| (Water Out) MinScale 0.0 %AT_1300 Bottoms|Conductivity| (Water Out) MaxScale 20.0 %AT_1300 Bottoms|Conductivity| (Water Out) EngUnits mhos %AT_1300 Bottoms|Conductivity| (Water Out) StepResponseTime 1.0 %AT_1300 Bottoms|Conductivity| (Water Out) DigFiltTimeCnst 0.016 And I need to convert this data to this f...

Auto-format in Microsoft Excel.
Each time i try to enter a number range, for example, 8- 10, in Excel, it constantly re-formats it to a date. If I change the formatting to "General" it turns it into a random number, usually 38209. I would like to turn off ALL auto-formatting, but that's probably asking too much. How do I disable this frustrating feature? thanks. Hi Paul When you enter "8-10" in a cell, that's not strictly a number but Excel thinks you mean a date so converts it as such. A date is a number and in your example the number 38209 represents August 10 2004 which is not a ra...

MS Money 95 data files
I hope that some one can answer this for me. I have used MS Money 95 for years, and it works just fine for me on Windows XP, however, I now have to reformat my hard drive, and have discovered that I can nolonger find my original install disk. Will the latest versions of Money still read the MS Money 95 data files. All that I have ever used the program for is to track my investments, and am unlikely to do any different in the future. Thanks Stan B In microsoft.public.money, Stan Banner wrote: >I hope that some one can answer this for me. >I have used MS Money 95 for years, and...

Excel not Access
I have designed an Access database that holds records relating to my stores audit results going back for about 5 years plus a load more information relating to these stores. This was used to produe a pack once a month, however a change in senior management means that I have got to shelve this and prodce a similar pack in Excel. The idea would be that the user could select a month or a 12 mnth date range that would produce data that could then be used to populate a number of excel templates that have been designed. Having not used excel for years I would be grateful for any suggestion...

How to keep format when importing Excel into SQL.
Can anybody help me please? When I import Excel file into SQL, a field that formated as 0000000000 (custom), loosing leading zeros. I tried to change data type in SQL after importing. No luck. I appretiate any help. See if using IMEX=1 helps: http://pratchev.blogspot.com/2007/10/importing-excel-data-into-sql-server.html -- Plamen Ratchev http://www.SQLStudio.com Plamen, I tried this, but got an error: "The OLE DB provider "Microsoft.Jet.OLEDB.4.0" has not been registered." Thank you very much for looking into this. "Plamen Ratchev" wr...

Unexpected error message on closing an Excel file
Suddenly I am getting the following message when I try to close a workbook: "Your formula contains an invalid external reference to a worksheet. Verify that the path, workbook, and range name or cell reference are correct, and try again" The mysterious thing is that it does not happen consistently and that, after I click OK after the above message, I can still save the file. What might be the cause of this error message and can the "invalid reference" be tracked down using one of the utility add-ins such as J. Walkenbach's PUP? If it only happens when you close ...

Where is the workspace file stored?
I was given a project folder containing several dozen files. So where is the workspace file normally located? If I don't have a workspace file how can I cerate one? Using VC version 6. TIA I haven't used VC6 for some time, but if I remember right you can just open the .dsp file and it will create a .dsw file for you. It typically goes in the same folder with the code. Tom "Phisherman" <noone@nobody.com> wrote in message news:be93539ccf8a6f25ibh4vt6ggmtbi024mq@4ax.com... >I was given a project folder containing several dozen files. So where > is the wor...

help with simple maths in excel
I want to do a simple arithmatic excercise in excel for my grand daughter. It is stuff like 2+2 =4 Smart me has hit a problem at the first hurdle... I need to put 2 in one cell the + in another cell and then 2 in another = in another and then she puts the answer in the next one. So the above would have 4 cells completed and she would put the answer in the 5th one. When I use the + or = sign in a cell of its own it (excel) thinks I am doing an equation, is there a way around this? I will work on the answer like if she gets it correct or wrong how I will do that...a sound or som...

Change File Locations to Private Drive (not Folder)
Hi, I know that I can use "File Locations" in "Options" so that whenever I use the "Open..." command in Word, it will open to a specific folder. I'm wondering if there is a way that this can be applied not to a folder but to a specific drive on a network. Our company has a main public drive and has also assigned each of the Staff their own private drive. Is there a way to access the "main page" (for lack of a better term) of my private drive each time I use "Open..." in Word? Right now it goes to "My Computer" or ...

How to change font size on formula bar in Excell 2007
I don't find Tools>Options>General (as suggested in other post answers) in Excel 2007. On the Office button there is an Excel Options but it doesn't provide a method of changing font size on the office but. My font is so small I can barely see it. Office button>ExcelOptions>Popular tab>in the "When creating new workbooks" section, choose font and font size -- Kind regards, Niek Otten Microsoft MVP - Excel "jimwillie" <jimwillie@discussions.microsoft.com> wrote in message news:588AAC05-0F52-404E-AA01-128E70E02D0B@microso...

Opening Excel Workbooks
I'm running into an issue where if I click on an Excel file through My Documents, it doesn't automatically bring it up. I get the toolbar but the actual spreadsheet doesn't appear on the screen. I have to click on the taskbar to get it to pop up. If I already have Excel active and I open a file through Excel, this doesn't happen. Any ideas? Here is a similar thread: http://www.excelforum.com/showthread.php?s=&threadid=237195 Rolli -- Message posted from http://www.ExcelForum.com Hi, Take a look at Tools-Options-General tab- uncheck ignore other application...

cant start outlook pst file to large
Hi I hope somebody may be able to help im new to outlook and now I cant start outlook message says cannot open your default email folders pst file its too large as I cannot open outlook I cannot delete old folders See if this helps: http://support.microsoft.com/kb/296088 -- -Ben- Ben M. Schorr, MVP Roland Schorr & Tower http://www.rolandschorr.com http://www.officeforlawyers.com/outlook.html Author: The Lawyer's Guide to Microsoft Outlook 2007: http://tinyurl.com/ol4law-amazon "Ray" <Ray@discussions.microsoft.com> wrote in message news:B3B824DC-3C9B-4B1B-8EF3-61...

How To Copy MS Word mailing labels into Excel
I have a word doc that I want to put into Excel. I want to add some more fields to the names and addresses. Is this simple or do I have to learn how to program? Michael Rodriguez City of Grand Prairie Michael, have you tried to copy and paste the data into excel? -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2000 & 97 ** remove news from my email address to reply by email ** "Michael Rodriguez" <mrodrigu@gptx.org> wrote in messa...

make subreport2 visible based on condition
Help, I am running Access 2003 and have trouble getting this work right. I have an unbound subreport that contains 3 additional subreports. I want only one of the 3 to be visible based on the value in a combo box on a selection form. I can't seem to get the reference right and have tried several variations. If Forms!frmWeeklyGLrpt!cboCC = 1 Then Me!subrptGLWeekly.Report!subrptGLWeeklyCMRDA.Visible = True Me!subrptGLWeekly.Report!subrptGLWeeklyCMRDB.Visible = False Me!subrptGLWeekly.Report!subrptGLWeeklyCMRDC.Visible = False End If If Forms!frmWeeklyGL...

How do I use traffic lights in excel
I am wanting to use traffic lights in excel that change colour based on the result of a variance cell, ie if the result of the cell is 10 make the traffic light green, if it is 20 make the traffic light amber, if the result is 30 make the traffic light red. How do I do this? Shorty Format>Conditional Formatting>Cell Value is: Note: you can add up to 3 conditions(4 if you count default) Gord Dibben Excel MVP On Wed, 22 Dec 2004 16:35:03 -0800, Shorty <Shorty@discussions.microsoft.com> wrote: >I am wanting to use traffic lights in excel that change colour based on the &g...

Drag and Drop file/directory names on Tree Control.
hi, I am writing an application in which i have one Tree control. Now i want that , when user drag & drop any file/folder on tree control the file name/folder name should be add in the tree control item. User may drag and drop file from desktop or may be from directory. I just want the path of that file/foder name nothing else. so plz tell me will it be possible ... Plz Help me............. Klic..... > I am writing an application in which i have one Tree control. >Now i want that , when user drag & drop any file/folder on tree >control the file nam...

how do I connect an object from one page to a different page?
I am trying to connect an object from one page to a seperate object on a different page. The instructions say to hold down your mouse button then click on the point you want it connected too. My problem is that is doesn't allow you to select the starting point of the connector, then select a different page, then click on your end point of the connector. Please help! try using a hyperlink. al "Pepper" <Pepper@discussions.microsoft.com> wrote in message news:3F5657F4-48EA-4681-A21E-D33FC7030401@microsoft.com... >I am trying to connect an object from one page to...

opening .bak file
Hi, I hope someone can help! I recently was performing a compacting operation on my outlook express folders. My computer shutdown due to a power failure and I lost some emails from a few of my folders. I was however able to get the .bak files (of the .dbx files that were lost) out of the recycle bin. If I could open one of these .bak files or convert it back to the .dbx file from which it was created I would retrieve these emails. Can anyone instruct me as to open this .bak file? Thanks for any help! Arnie K. How did you get the bak files out of the Recycle Bin? All e...

Can I make messages unable to be forwarded by the receiver?
We are interested in setting up a private email group at work that receives semi-confidential information. Is there a way to make the emails that these users will receive unable to be forwarded to people outside of the group? Make private, or somehow else prevent the information from getting outside of the approved recipient list? no. and you can't keep people from printing it, copying and pasting the contents of it, taking a screen shot of it, etc, etc... "Jonna Kosalko" wrote: > We are interested in setting up a private email group at work that receives ...

Trying to read XML file into dataset
Hello. Developing a web site in VS2005, SP1, VB, .NET 2.0, ASP.NET 2.0 on XP Pro, SP2. I eventually want to use a gridview table to view xml data, but right now i can't seem to get my xml data into a dataset so that i can use it. I have an XML file and can open it in IE. There is no XSD or XSL file to go with it. I can't seem to get the XML data into a dataset. I tried using the following code, but it just does nothing. It doesn't give an error. It just executes the code and does nothing. Dim dataSet As DataSet = New DataSet dataSet.ReadXml("...

Linking information form one worksheet to another
Hi, i have a big problem i want to create a link between some columns in two seperate worksheets, so that when i type a name on the master sheet it would give me the required information.Dont know if i explained this right, lets say on the master sheet i have columns : Name,Sex and Height on columns A,D and BH respectively i want that if i type a person's name in worksheet 2 it should give me the results on columns A,C,F in that worksheet. Please help i need it asap for my director One way .. Assuming your "master" sheet is named: Master, with data in row1 down In Shee...

Excel DNS query
Hello, Is there a way for an Excel function to query a DNS server? Thanks. Soundy Not that I know of, but you can turn on the macro recorder, use 'get external data' and tailor the resulting code into a user function of your own. E.g. I've used this to create a button to get MS-Access data from a query that has the same name as the sheet (tab) name. It saves me a lot of copy-paste actions. Bas Hartkamp <soundy@gmail.com> schreef in bericht news:1151940450.029823.127570@j8g2000cwa.googlegroups.com... > Hello, > > Is there a way for an Excel function ...