Hi Guys,
I have a text files that contains various information I need to feed into excel, I have tried importing data but the values in the text file are not organized well enough.
I would like to be able to search for a string like "field" and then store the the values on the same line immediately after it into excel. cells.
PD1 * * Client and Well Information 03-MAY-2011 16:27
PDB mode LIS USA
Company XXX
Well XXXX XX
Field WILDCAT
Prvnc/co XXX
Cntry/st XX XXX
Location XX XX XX
Unique well Id.
API Number XX XX API Number
Location 2 SW SW NW NE
Lsd Sec Twp Rge XX XX
Permit number Permit Number
Permanent Datum G.L.
Elevation XXX feet
Log Measured from K.B. @ 7 FEET
Elevation above PD feet
Elevn. of log zero feet
Drill measured from K.B.
Elevations: KB XXX F feet
DF XXX F feet
GL XXX F feet
pls send me the file, let me try
Last edited by DonkeyOte; 06-26-2011 at 04:27 AM. Reason: removed unnecessary quote
vasantjob
Don't quote whole posts unless necessary.
Hope that helps.
RoyUK
--------
If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need
For Excel Tips & Solutions, free examples and tutorials why not check out my downloads
New members please read & follow the Forum Rules
Remember to mark your questions Solved and rate the answer(s)
Thanks for the help, I've attached the file.
@vasantjob,
For reference: sample files should be attached on threads directly and not sent via PM/Email. Private correspondence rather defeats the purpose of a public forum.
Sample files should of course be stripped of confidential info.
@thegoat001, I would suggest posting an Excel file that shows desired results given sample data.
My Recommended Reading:
Volatility
Sumproduct & Arrays
Pivot Intro
Email from XL - VBA & Outlook VBA
Function Dictionary & Function Translations
Dynamic Named Ranges
I'm hoping that I do not need to post a sample excel file...once I know how to extract one value from the text files I'm hoping I can get the rest. Once the values are extracted and placed in individual cells I will be able to process them further. Some examples would be well name, company name, location, etc.
try this
Sub ReadFile() Fl = "C:\Documents and Settings\Desktop\Sample text file.txt" Dim myFileName As String Dim myLine As String Dim FileNum As Long myFileName = Fl FileNum = 1 Close FileNum Open myFileName For Input As FileNum Do While Not EOF(FileNum) Line Input #FileNum, myLine Debug.Print myLine Loop End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks