+ Reply to Thread
Results 1 to 9 of 9

Vba macro to combine all worksheet in to one tab delimited file.

  1. #1
    Registered User
    Join Date
    05-08-2018
    Location
    US
    MS-Off Ver
    2013
    Posts
    9

    Vba macro to combine all worksheet in to one tab delimited file.

    Hi,

    Could you please help me with vba macro to combine all worksheet in to one tab delimited file. In the tab delimited file quotes should no e present if there is comma (,) in the data.

    I wanted to plug this in to one of the macro in which it pivot all the tabs , add header, replace few things.

    Thank You for your help.

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Vba macro to combine all worksheet in to one tab delimited file.

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Registered User
    Join Date
    05-08-2018
    Location
    US
    MS-Off Ver
    2013
    Posts
    9

    Re: Vba macro to combine all worksheet in to one tab delimited file.

    Please see attached 'demo1', which has sample data. And file 'output.txt' which is desired output in tab delimited format.

    Thank You for your help.
    Attached Files Attached Files

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,481

    Re: Vba macro to combine all worksheet in to one tab delimited file.

    This will add a sheet, then loop through the other sheets and copy/paste to the new sheet, then you can save the sheet as a Text file.

    Use your macro recorder to see a code to save...............


    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    05-08-2018
    Location
    US
    MS-Off Ver
    2013
    Posts
    9

    Re: Vba macro to combine all worksheet in to one tab delimited file.

    Hi davesexcel,

    In my scenario each tab will have around 300,000 rows. It has 14 tabs. If we combine all tabs in to one and then save the new sheet as tab delimited. I was thinking excel has 1,048,576 limit.
    Thus look like combining all tabs in to one will have issue. I was thinking if we can append data from each tab in to one tab delimited file, should be ok. What are your thoughts?

    Thank you for your reply.
    Last edited by datajan; 05-11-2018 at 05:50 PM.

  6. #6
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Hi ! Try this ‼


    According to the attachment, a demonstration as a starter :

    PHP Code: 
    Sub Demo1()
            
    Dim Ws As WorksheetR&
            
    Open ThisWorkbook.Path "\Output .txt" For Output As #9
            
    Print #9, Join(Application.Index(Worksheets(1).UsedRange.Rows(1).Value, 1, 0), vbTab)
        
    For Each Ws In Worksheets
            With Ws
    .UsedRange.Rows
                
    For 2 To .Count
                    
    Print #9, Join(Application.Index(.Item(R).Value, 1, 0), vbTab)
                
    Next
            End With
        Next
            Close 
    #9
            
    MsgBox "Done"vbInformation" Export"
    End Sub 
    Do you like it ? So thanks to click on bottom left star icon « Add Reputation » !

  7. #7
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Vba macro to combine all worksheet in to one tab delimited file.

    Try
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    05-08-2018
    Location
    US
    MS-Off Ver
    2013
    Posts
    9

    Re: Vba macro to combine all worksheet in to one tab delimited file.

    Sorry for late replying. Thank you Marc L and Jindon for your help. Code worked fine.

  9. #9
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Vba macro to combine all worksheet in to one tab delimited file.

    You are welcome and thanks for the rep.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Script/macro to save a copy as tab delimited text file and then close original file
    By Merlin803 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-02-2015, 01:34 PM
  2. Save worksheet as pipe delimited TXT file
    By nellaneb in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-06-2015, 12:47 PM
  3. Save worksheet as pipe delimited TXT file
    By nellaneb in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-05-2015, 09:37 PM
  4. Combine Excel Sheets (+2 Million Rows total) and Create Pipe Delimited TEXT File
    By kestefon in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-05-2013, 08:51 PM
  5. Saving a worksheet as a asterik delimited text file
    By mattman123 in forum Excel General
    Replies: 2
    Last Post: 09-19-2013, 11:31 PM
  6. Macro to convert comma delimited csv file to excel file??
    By sanjeevpandey in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-15-2012, 05:31 AM
  7. [SOLVED] save an Excel worksheet as a comma delimited file?
    By Trophy Man in forum Excel General
    Replies: 2
    Last Post: 01-08-2005, 12:06 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1