1 text row to single column

jinomar25

New Member
Joined
May 21, 2013
Messages
2
I have problem in making this. format in a text file
Note: The text is only on A1, separated by a delimiter indicator which is "^"

https://docs.google.com/file/d/0B_eArBbGfxv4OTJ2YTlDaFBnZDA/edit?usp=sharing

To this . . . after text file multiple import to excel
As you can see in the image, all the text will be in one column which is A1.

https://docs.google.com/file/d/0B_eArBbGfxv4T3dpUnZaQlFVdVk/edit?usp=sharing

Here's the program I am working on:

Code:
Private Sub CommandButton1_Click()

Application.ScreenUpdating = False


Dim oFileDialog As FileDialog
Dim LoopFolderPath As String
Dim oFileSystem As FileSystemObject
Dim oLoopFolder As Folder
Dim oFilePath As File
Dim oFile As TextStream
Dim RowN As Long
Dim ColN As Long
Dim iAnswer As Integer
On Error GoTo ERROR_HANDLER


Set oFileDialog = Application.FileDialog(msoFileDialogFolderPicker)


RowN = 1
ColN = 1


        With oFileDialog
        If .Show Then
    
    ActiveSheet.Columns(ColN).Cells.Clear
    LoopFolderPath = .SelectedItems(1) & "\"


    Set oFileSystem = CreateObject("Scripting.FileSystemObject")
    Set oLoopFolder = oFileSystem.GetFolder(LoopFolderPath)


    For Each oFilePath In oLoopFolder.Files
    Set oFile = oFileSystem.OpenTextFile(oFilePath)


       With oFile
    
    Do Until .AtEndOfStream
    
    ActiveSheet.Cells(RowN, ColN).Value = .ReadLine
    LoopFolderPath = Space(1)
    RowN = RowN + 1
     
        Loop
  
        .Close
    
    End With
      
      'oLoopFolderPath = Split(ActiveCell, "^")
      'ActiveCell.Resize(UBound(oLoopFolderPath) + 1) = WorksheetFunction.Transpose(oLoopFolderPath)
        ActiveSheet.Range("A:A").TextToColumns Destination:=Range("A1") _
        , DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, Other:=True _
        , OtherChar:="^"
    
         ActiveSheet.UsedRange.Columns.AutoFit
         


    Next oFilePath
    
    End If
        
         iAnswer = MsgBox("Your Textfiles have been Inputted.", vbInformation)


    End With


EXIT_SUB:
Set oFilePath = Nothing
Set oLoopFolder = Nothing
Set oFileSystem = Nothing
Set oFileDialog = Nothing


    Application.ScreenUpdating = True


    Exit Sub


ERROR_HANDLER:
    Err.Clear
    GoTo EXIT_SUB


End Sub

Please Help. Thank you
 
Last edited:

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
I'm not sure what you want to accomplish. As I understand your textfile contains text on one line separated by the delimiter indicator "^". Do you want the text parts to be presented on individual rows in column A?
 
Upvote 0
If you use Excel text import guide (open the text file within Excel) you can define the tab separator ^ as Other.
When Excel has converted the file you will have the text parts in different columns.
If you want the data to be presented in column A just mark all data - Copy - Goto cell A1 - Paste special values - Transposed
 
Upvote 0

Forum statistics

Threads
1,214,896
Messages
6,122,132
Members
449,066
Latest member
Andyg666

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top