0
votes

For example, Lets say I have 5 text files.

file name : File1.txt data : vmkfmoemfvkmdfv

file name : File2.txt data : ppvlvlvl

file name : File3.txt data : wwwererer

file name : File4.txt data : mmki

file name : File5.txt data : qwerr

Now what I want is to add each file's data into separate cells of a column.

What I did previously was- Opened File1.txt, Copied all data inside it, Selected a cell, Pasted it in the cell.

Is there any automatic way to do that ??

Please help !!!!

2

2 Answers

0
votes

No there is no way to do this. If you are not prepared to make your own little program. But that's a lot more work then what you described.

0
votes

Give this tiny macro a try:

Sub basement()
    For i = 1 To 5
        Close #1
        Open "C:\TestFolder\File" & i & ".txt" For Input As #1
        Line Input #1, TextLine
        Cells(i, "A").Value = TextLine
        Close #1
    Next i
End Sub

Adjust this to use your own folder name(s)