Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
ep ep is offline
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel - merging numerous files drumbumuk Excel Discussion (Misc queries) 7 August 12th 08 04:41 PM
Inserting text into numerous cells for many different files joshua Excel Discussion (Misc queries) 4 December 29th 06 06:09 PM
Extracting Numerous Text files into Excel [email protected] Excel Programming 7 May 17th 06 02:00 AM
Help extract numerous text files and how to use avg formula [email protected] Excel Worksheet Functions 0 May 16th 06 11:38 PM
reading data from text files in VBA Arne[_3_] Excel Programming 3 January 27th 04 10:07 AM


All times are GMT +1. The time now is 01:05 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"