Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Reading from Numerous Text Files into Excel Column
Hi all, I have a column containing various filenames of text files
which reside in a local folder. I'd like the column next to this to contain the actual text located inside each file. These text files are just one line so I don't need a complicated text reader, just something basic and preferably something that updates when opening the spreadsheet or perhaps when I hit a button if this will be a macro. I could do this manually, but there are hundreds of files. Any suggestions? Thanks for any help. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Reading from Numerous Text Files into Excel Column
Sub Test()
Dim iLastRow As Long Dim i As Long Dim oWB As Workbook Application.ScreenUpdating = False With ActiveSheet iLastRow = .Cells(.Rows.Count, "A").End(xlUp).Row For i = 1 To iLastRow On Error Resume Next Set oWB = Workbooks.Open(.Cells(i, "A").Value) On Error GoTo 0 If Not oWB Is Nothing Then .Cells(i, "B").Value = oWB.Worksheets(1).Range("A1").Value oWB.Close savechanges:=False End If Next i End With Application.ScreenUpdating = True End Sub -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "ep" wrote in message oups.com... Hi all, I have a column containing various filenames of text files which reside in a local folder. I'd like the column next to this to contain the actual text located inside each file. These text files are just one line so I don't need a complicated text reader, just something basic and preferably something that updates when opening the spreadsheet or perhaps when I hit a button if this will be a macro. I could do this manually, but there are hundreds of files. Any suggestions? Thanks for any help. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel - merging numerous files | Excel Discussion (Misc queries) | |||
Inserting text into numerous cells for many different files | Excel Discussion (Misc queries) | |||
Extracting Numerous Text files into Excel | Excel Programming | |||
Help extract numerous text files and how to use avg formula | Excel Worksheet Functions | |||
reading data from text files in VBA | Excel Programming |