Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 11-21-2013, 04:28 PM
omahadivision omahadivision is offline Way to search for a string in text file, pull out everything until another string? Windows 7 32bit Way to search for a string in text file, pull out everything until another string? Office 2007
Novice
Way to search for a string in text file, pull out everything until another string?
 
Join Date: Oct 2012
Posts: 28
omahadivision is on a distinguished road
Default Way to search for a string in text file, pull out everything until another string?

Hi Guys,



I am trying to think of a way to use Excel to pull data out of a text file. I would want all the data after a certain line but before another line. The starting and ending line would always be the same, but the line numbers and amount of data between the two lines would be different. I would want to pull data line by line without using delimiters, as the data I am pulling from uses a space differently than Excel.

Any tips? This is some coding I've come up with so far. It will only tell me the row that the string I am searching for is on:
Code:
Open Fname For Input As #1
  iRow = 1
  Do While Not EOF(1)
     Input #1, A
     If A = "1990" Then
    MsgBox iRow
     End If
     iRow = iRow + 1
  Loop
  Close 1
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Way to search for a string in text file, pull out everything until another string? Macro to create new word doc and save the file using String found in the document VBNation Word VBA 2 02-08-2013 07:14 AM
Way to search for a string in text file, pull out everything until another string? Find and replace a string of text errtu Word 1 01-31-2013 02:09 PM
Excel Fomula to search for a string and display value from different column zeeshanbutt Excel 1 07-29-2012 12:48 AM
Way to search for a string in text file, pull out everything until another string? Convert numbers to a specific text string francis Excel 1 10-06-2011 01:43 PM
Extract numbers from a text string aleale97 Excel 4 02-10-2011 10:33 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:28 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft