• 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.

Extract certain data from text and copy to excel

axebrock73

New Member
hi all


I would like to extract three data from the text file according to the date and hour they are in. The results is shown in the attached excel file. Bascially, i would like to get the ENERGY, STD VOLUME from the PRV HOURLY TOTAL of the STATION (FT-28U06, FT-28U07) and paste to the excel cells as shown in the results of my attached excel file. Next, is to copy the CV of STREAM FT-28U08 and also paste to the excel.

The excel file which i attached is the actual results which i want and manually copy from notepad to excel. I hope i can have macro to do it for me.

Thanks in advance to those who could help me.


▬▬▬▬▬▬▬▬▬ Mod edit : thread moved to appropriate forum !
 

Attachments

  • test3.xls
    17 KB · Views: 8
  • test3_a.txt
    5.3 KB · Views: 8
hi vletm

I put the text file in the same folder and run it but i can't get the results. Can modify the code to open the text file in notepad and grab the hourly data and paste it to excel ? Thanks.
 
Thanks vletm and sorry for not saying it in the beginning. Btw, U are using VB script ? I'm sorry if i ask a dumb question. I have very little vb experience as i am not a programmer or developer. I am trying to learn some vb codes from you guys so that i can use it to make my work more efficient.
 
Hi vletm

I'm really appreciated your prompt reply. Thank you so much.
However, may i request your code to be in vba instead of VB script? Thanks.
 
i tried to insert more data into the text file and it is generating an automation error. need to increase the number of rows?
 
axebrock73 - okay!
I could write only that
You wrote from the PRV HOURLY TOTAL - okay? but
You add also data from the PRV DAY TOTAL - that's so different!
Previous code tried to find 'blue keyword' --- loooong time!

Of course, the code should have a check point (now there is) that
if cannot find 'blue keyword' to give up and relax.
>> Test again <<
 

Attachments

  • test3.xls
    73.5 KB · Views: 0
Hmm I only want to extract PRV HOURLY TOTAL for energy,std volume and also the CV. Your code should work. I only merely add more hourly data to the text file. Initially I attached the text file for u. I only give you data of two hours. The reason is to make it simple for you to understand my needs and your code really works well for that two hours of data but when I try to use your code for more data, the program just hang there. Anyway, thanks for your help.
 
Hi vletm
the PRV DAY TOTAL results is generated by a measurement equipment, not I want to purposely put it in. May I know how do u ignore the PRV DAY TOTAL and its related rest of the data ?
 
Last edited:
axebrock73
You may know ...
I can do it this way ... or actually You gotta do it:
You select by Cell G1 (activate it by mouse) ... include or not include Day Totals
 

Attachments

  • test3.xls
    84.5 KB · Views: 6
wow this is nice, I think I start to know what u mean. I can even choose to include or not to include the PRV DAY TOTAL. thank u very much.
 
Back
Top