Results 1 to 4 of 4

adding text to columns to an existing macro

Threaded View

  1. #1
    Registered User
    Join Date
    02-25-2014
    Location
    Boston, MA
    MS-Off Ver
    Excel 2010
    Posts
    11

    adding text to columns to an existing macro

    Hello,
    I am having trouble adding "text to columns" language to a macro I already built. I have built the following macro that allows me to pull in multiple text files into excel:
    Sub GetSheets()
    Path = "H:\Test\"
    Filename = Dir(Path & "*.txt")
    
    Do While Filename <> ""
    Workbooks.Open Filename:=Path & Filename, ReadOnly:=True
    ActiveWorkbook.Sheets(1).Copy After:=ThisWorkbook.Sheets(1)
    
    
    Workbooks(Filename).Close
    Filename = Dir()
    Loop
    End Sub
    The only problem is that the text file is importing in one string and not allowing me to perform a search. I would like to build code into my macro so it will automatically apply "text to columns" while the file is populating. The files are all different sizes but here is a sample of what I received from my recording:
    Sub Macro4()
        Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
            TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
            Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
            :=Array(1, 1), TrailingMinusNumbers:=True
    End Sub
    Any help is greatly appreciated! Thank you!
    Last edited by vlady; 02-25-2014 at 07:53 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] adding text in front of potentially existing text (in 1 cell) with IF/THEN statement
    By Marijke in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-10-2014, 04:20 AM
  2. Replies: 8
    Last Post: 11-12-2012, 02:39 PM
  3. Checking Columns and Adding For Non Existing Data
    By pterodactyl in forum Excel General
    Replies: 12
    Last Post: 09-25-2011, 07:16 AM
  4. Adding text to the end of existing string / text.
    By DTK in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-30-2010, 02:51 AM
  5. adding text to existing text in whole coulumn
    By mrwhitee in forum Excel General
    Replies: 2
    Last Post: 08-30-2005, 07:10 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