Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
gus gus is offline
external usenet poster
 
Posts: 5
Default open some txt files ,find text , copy the text before that to a single cell

I am trying to make a macro that open all the texts files from a specified
directory one by one.

Everytime a txt file is opened i want to search for a specified string (for
ex. PETER)
and if the string exists then all the text before this string must copied to
a empty cell at any colunm (for example c1)

Then the secont text to c2 , c3 e.t.c

lets see an example.

The text file text1.txt has the folowing text.

"sdfgdfg dfgdfgsd fghdfghfgh
fgfghdfgh gfhfghdfgh fghfdgh

fghfdgh gfhdfgh fghfgh 54645645 5464546
gfhdfghfg
gfhfghj vcbncvbn hfgh rthyrtyertyrty
greece summertime dfrdfg errtt retyrty fdgsdfg gh
sdfghfgh dfghdfgh dfghdfgh
fghdfgh
fghdf
fghfhgffghdfhfgh fghfgh dfghdfghdfgh"

I search the string "greece" .
Tha macro finds it and then copies all the text before and up to this string
to the cell a1.

Then comes the secont txt file , then the third etc.

Thanks





  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default open some txt files ,find text , copy the text before that to a single cell

Is the text in multiple cells? If in multiple cells, is it in multiple
columns? Do you want to concatenate all the text and put it in a single
cell? Where is this single cell located?

--
Regards,
Tom Ogilvy


"gus" wrote in message
...
I am trying to make a macro that open all the texts files from a specified
directory one by one.

Everytime a txt file is opened i want to search for a specified string

(for
ex. PETER)
and if the string exists then all the text before this string must copied

to
a empty cell at any colunm (for example c1)

Then the secont text to c2 , c3 e.t.c

lets see an example.

The text file text1.txt has the folowing text.

"sdfgdfg dfgdfgsd fghdfghfgh
fgfghdfgh gfhfghdfgh fghfdgh

fghfdgh gfhdfgh fghfgh 54645645 5464546
gfhdfghfg
gfhfghj vcbncvbn hfgh rthyrtyertyrty
greece summertime dfrdfg errtt retyrty fdgsdfg gh
sdfghfgh dfghdfgh dfghdfgh
fghdfgh
fghdf
fghfhgffghdfhfgh fghfgh dfghdfghdfgh"

I search the string "greece" .
Tha macro finds it and then copies all the text before and up to this

string
to the cell a1.

Then comes the secont txt file , then the third etc.

Thanks







  #3   Report Post  
Posted to microsoft.public.excel.programming
gus gus is offline
external usenet poster
 
Posts: 5
Default open some txt files ,find text , copy the text before that to a single cell

The text string i am searcing is located in all the text Files
And is a number that defines what this text file is (for example (law 324)
, (law 456)
I am trying to make make an indexer for these txt files
An indexer that describe that at <txt1.txt file is the Law 324 , at
<txt2.file is the Law456 e.t.c
Thanks


"Tom Ogilvy" wrote in message
...
Is the text in multiple cells? If in multiple cells, is it in multiple
columns? Do you want to concatenate all the text and put it in a single
cell? Where is this single cell located?

--
Regards,
Tom Ogilvy


"gus" wrote in message
...
I am trying to make a macro that open all the texts files from a
specified
directory one by one.

Everytime a txt file is opened i want to search for a specified string

(for
ex. PETER)
and if the string exists then all the text before this string must copied

to
a empty cell at any colunm (for example c1)

Then the secont text to c2 , c3 e.t.c

lets see an example.

The text file text1.txt has the folowing text.

"sdfgdfg dfgdfgsd fghdfghfgh
fgfghdfgh gfhfghdfgh fghfdgh

fghfdgh gfhdfgh fghfgh 54645645 5464546
gfhdfghfg
gfhfghj vcbncvbn hfgh rthyrtyertyrty
greece summertime dfrdfg errtt retyrty fdgsdfg gh
sdfghfgh dfghdfgh dfghdfgh
fghdfgh
fghdf
fghfhgffghdfhfgh fghfgh dfghdfghdfgh"

I search the string "greece" .
Tha macro finds it and then copies all the text before and up to this

string
to the cell a1.

Then comes the secont txt file , then the third etc.

Thanks









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
Find text in a cell and copy text to another cell Shaun Excel Discussion (Misc queries) 6 July 4th 07 05:25 PM
Copy List of text to a single cell? nastech Excel Discussion (Misc queries) 3 February 15th 06 02:19 AM
Copy List of text to a single cell? CLR Excel Discussion (Misc queries) 0 February 13th 06 08:39 PM
How to I copy text from a range of cells to another single cell? WRT Excel Discussion (Misc queries) 2 December 18th 05 06:17 AM
Find text in cell, copy row to new sheet Ajay Excel Discussion (Misc queries) 6 June 29th 05 08:40 AM


All times are GMT +1. The time now is 01:36 PM.

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

About Us

"It's about Microsoft Excel"