+ Reply to Thread
Results 1 to 4 of 4

Excel Files Merge Troubleshoot!

  1. #1
    Registered User
    Join Date
    08-07-2019
    Location
    Sydney, Australia
    MS-Off Ver
    2016
    Posts
    4

    Excel Files Merge Troubleshoot!

    Hi,

    I'm trying to merge the attached 2 excel files with below VBA code. It will copy all data from Summary011 but left out the last two lines from Summary002.
    My guess is that because column A is blank for those two lines. How do I modify this VBA to include the last lines with blank in column A?
    Many thanks.

    "
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by Pepe Le Mokko; 01-09-2020 at 04:25 AM. Reason: Removed unnecessary title part - Added code tags

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,453

    Re: Excel Files Merge Troubleshoot!

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    I did it for you this time. Please read forum rules. Thanks

  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,930

    Re: Excel Files Merge Troubleshoot!

    A simpler way would to use Power Query to append one to the other as demonstrated in the attached.
    Attached Files Attached Files
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  4. #4
    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 beginner starter demonstration to paste to the destination worksheet module
    then save the workbook to the csv source folder (or amend before saving the path variable in the next VBA code) :

    PHP Code: 
    Sub Demo1()
          
    Dim P$, F$, N%
              
    ThisWorkbook.Path Application.PathSeparator
              Me
    .UsedRange.Clear
              F 
    Dir("*.csv")
        While 
    ""
            
    With Me.QueryTables.Add("TEXT;" FCells(Me.UsedRange.Rows.Count Not IsEmpty([A1]), 1))
                .
    AdjustColumnWidth False
                
    .TextFileColumnDataTypes = [{1,1,4,1,1,1,1,1,1,1,4,1,1,1,1,1}]
                .
    TextFileCommaDelimiter True
                
    .TextFileDecimalSeparator "."
                
    .TextFileStartRow + (0)
                .
    TextFileTextQualifier xlTextQualifierNone
                
    .Refresh False:  .Delete
            End With
              N 
    1
              F 
    Dir
        Wend
              MsgBox 
    "# csv imported : " NvbInformation" Import"
    End Sub 
    ► Do you like it ? ► ► So thanks to click on bottom left star icon « Add Reputation » !

+ 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. [SOLVED] troubleshoot code that no longer saves files within a newly created folder
    By TBM in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 12-25-2018, 11:11 AM
  2. [SOLVED] Merge two Private Sub Worksheets - Troubleshoot
    By Quivolt in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-12-2018, 03:03 PM
  3. [SOLVED] Merge Excel Files
    By worswick25 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-30-2013, 03:22 PM
  4. merge excel files
    By mlk in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-03-2007, 10:22 AM
  5. [SOLVED] troubleshoot merge cells - checked protection. Why is icon dim?
    By Walter K in forum Excel General
    Replies: 4
    Last Post: 12-13-2005, 11:20 AM
  6. Merge two Excel files
    By Teleinternnor in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-13-2005, 04:05 PM
  7. [SOLVED] merge files in Excel?
    By Hugh Jordan in forum Excel General
    Replies: 1
    Last Post: 04-20-2005, 11: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