Hello,
Can somebody please help me to create a macro to simply read the last 3 lines of a txt file, then insert it in the sheet?
Thanks!![]()
Hello,
Can somebody please help me to create a macro to simply read the last 3 lines of a txt file, then insert it in the sheet?
Thanks!![]()
Good morning
Sure. What order do you want them in? This macro puts them in the order that the text file shows them :Can somebody please help me to create a macro to simply read the last 3 lines of a txt file, then insert it in the sheet?
HTH![]()
Sub Tester() Dim a() Open "d:\work\test.txt" For Input As #1 counter = 0 Do While Not EOF(1) Line Input #1, data counter = counter + 1 ReDim Preserve a(counter) a(counter) = data Loop Close #1 For n = 3 To 1 Step -1 Cells(n, 1).Value = a(UBound(a) - n + 1) Next n End Sub
DominicB
Please familiarise yourself with the rules before posting. You can find them here.
dominicb: thanks so much! awesome, works great!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks