• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA code for extracting text from txt file

Excel_Novice28

New Member
Hi, hoping somebody here can shed some light on my query below.

I am currently trying to write a Macro that will extract information from a large number text files in a particular folder.

In the final excelsheet I would like to display the original text file name (usually labelled as numbers) in column A, and then the second line of the text file in column B (ideally chr1:51957970-54566190 ) from the attached file

An example of the txt file is below.
Any suggestions?
 

Attachments

  • Chr position..txt
    952 bytes · Views: 9
Hi, unclear for column A expected result …

For column B you can use Split or Mid function, to see in VBA inner help.
It depends if the second line is always structured the same way
whatever the source text file …
 
Can you post a sample file of what you expect the output to be ?
 
Back
Top