+ Reply to Thread
Results 1 to 6 of 6

Merging txt files using VBA into a current worksheet

  1. #1
    Registered User
    Join Date
    10-26-2021
    Location
    France
    MS-Off Ver
    2013
    Posts
    20

    Merging txt files using VBA into a current worksheet

    Hi Everyone

    I am trying to merge txt files using VBA into a current worksheet.
    The first line of each txt file is NOT to be merged.
    The LOG file is to be imported into specific columns in a current worksheet as adjacent columns containing formulas will access this data.
    I have managed to import the first LOG file but I do not understand how to create a loop to repeat the import for all txt files.
    I have included a tab "Merged files when imported" to show what the program should do when the 3 files are correctly imported

    Many thanks in advance for your help. I am new to programming

    Chris
    Attached Files Attached Files

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

    Re: Merging txt files using VBA into a current worksheet

    Working with "UTF-16" here.
    If this doens't work at your end, try change to "UTF-8"
    Assuming all files incl. master workbook are in the same folder.
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    10-26-2021
    Location
    France
    MS-Off Ver
    2013
    Posts
    20

    Re: Merging txt files using VBA into a current worksheet

    Hi Jindon
    Thank you for your reply. however, I receive a runtime error 1004 when I run the macro
    IN VBA the line With [a3].Resize(n) is highlighted
    Chris

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

    Re: Merging txt files using VBA into a current worksheet

    See the attached,
    "my result" sheet is the result I got.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    07-13-2022
    Location
    USA
    MS-Off Ver
    11
    Posts
    1

    Re: Merging txt files using VBA into a current worksheet

    The + operator has the main purpose of adding two numbers.

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

    Re: Merging txt files using VBA into a current worksheet

    Quote Originally Posted by morgenstern1 View Post
    The + operator has the main purpose of adding two numbers.
    Although this is a true statement, why is it here?

+ 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. Merging two current spreadsheets
    By Playgolf in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-10-2018, 11:53 AM
  2. [SOLVED] Merging Data from multiple excel files into 1 single worksheet
    By Nerpilis in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-16-2014, 12:13 PM
  3. Merging multiple excel files in a folder into one master worksheet in a new worksheet
    By johnny_canuck in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 08-22-2013, 12:20 PM
  4. Merging specified worksheet in multiple files into 1 merged file
    By RebeccaEllis in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-17-2012, 11:22 AM
  5. Merging particular worksheet from Multiple Files in a folder into a single workbook
    By excelhelp18 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-30-2012, 01:37 AM
  6. Merging two files together based on col common to both files
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-05-2011, 01:06 PM
  7. Merging multiple files into 1 worksheet
    By markie in forum Excel General
    Replies: 1
    Last Post: 12-18-2006, 01:23 PM

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