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

1 Star2 Stars3 Stars4 Stars5 Stars (4 votes, average: 4.75 out of 5)
Loading...
Go back to All Questions Login or Register
Solved164 views
0

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

Loop
.Close
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,
Bren

0

Try something like this:

Simply the best place to learn VBA!

Error: Please enter a valid email address

Error: Invalid email

Error: Please enter your first name

Error: Please enter your last name

Error: Please enter a username

Error: Please enter a password

Error: Please confirm your password

Error: Password and password confirmation do not match