Here is the updated macro. The attached workbook has a button on "sheet1" to run the macro.
Sub ReadTextFiles()
Dim CellData As String
Dim FileName As String
Dim FilePath As String
Dim LineCnt As Long
Dim R As Long
Dim Text As String
Dim Wks As Worksheet
R = 1
Set Wks = Worksheets("Sheet1")
FilePath = "C:\Users\Platinum\Desktop\ExcelMacro"
FileName = Dir(FilePath & "\*.txt")
Do While FileName <> ""
LineCnt = 0
CellData = ""
N = FreeFile
Open FilePath & "\" & FileName For Input As #N
Do While Not EOF(N)
Line Input #N, Text
LineCnt = LineCnt + 1
If Text = "" Then Text = " " & vbLf
If LineCnt = 1 Then
Wks.Cells(R, "A").Value = Text
Else
CellData = CellData & Text
End If
Loop
Wks.Cells(R, "B").Value = CellData
Close #N
R = R + 1
FileName = Dir()
Loop
End Sub
Bookmarks