Need Help In Modifying my vba code for reading a text file [Solved]

1 Star2 Stars3 Stars4 Stars5 Stars (7 votes, average: 4.86 out of 5)
Go back to All Questions Login or Register
Solved1160 views

Hi AnalystCave!

I need help in modifying my code below:

Sub test()
Dim fn As String
fn = “C:\Users\Bren\Documents\sleep tonight-december avenue.txt”
With CreateObject(“Scripting.FileSystemObject”).OpenTextFile(fn)
Do Until .AtEndOfStream
If .Line > 100 Then Exit Do
Cells(.Line, 24).Value = .ReadLine

End With
End Sub

It reads a text file but my desired output is for the text file to be copied in just one cell specifically….any suggestions would be a great help…Thanks in Advanced AnalystCave!!! More Power!!!

Yours Truly,


Try something like this:

Simply the best place to learn VBA!