excel length
New Member
- Joined
- Jan 29, 2013
- Messages
- 19
I need some help in extracting text from a text file using VBA.
I have a vba code that copy-paste a text file to excel and run from there on.
But recently, having lots of line and formula within the excel slows down the process.
the file contains from hundred to thousand of lines.where as I only need a portion of it.
So I wanted to rework(maybe start from scratch) on my vba code such that it will search and copy a line or array from the file instead of putting it all in the excel.
Example:
let's say my file contains the data above.
and I want these results:
first: search-copy-paste the array "monday"
second: search-copy-paste a line that contains "apple"
third: search-copy-paste a line that contains "apple" with the "day"
my file is much more complicated than this, I need a code to start with.
and these files contains variable number of "fruits" and "days" so i might need some loop to scan through the whole file
Thank you.
I have a vba code that copy-paste a text file to excel and run from there on.
But recently, having lots of line and formula within the excel slows down the process.
the file contains from hundred to thousand of lines.where as I only need a portion of it.
So I wanted to rework(maybe start from scratch) on my vba code such that it will search and copy a line or array from the file instead of putting it all in the excel.
Example:
monday
apple 10 5 20 50 100
banana 12 24 10 11 15
orange 1 20 30 50 60
tuesday
apple 11 30 44 58 15
banana 78 8 52 99 15
orange 60 66 100 12 11
monday
banana 1 55 66 7 88 12
apple 1 668 10 78 896
orange 2 36 67 36 97
let's say my file contains the data above.
and I want these results:
first: search-copy-paste the array "monday"
monday
apple 10 5 20 50 100
banana 12 24 10 11 15
orange 1 20 30 50 60
monday
banana 1 55 66 7 88 12
apple 1 668 10 78 896
orange 2 36 67 36 97
second: search-copy-paste a line that contains "apple"
and if possibleapple 10 5 20 50 100
apple 11 30 44 58 15
apple 1 668 10 78 896
third: search-copy-paste a line that contains "apple" with the "day"
monday apple 10 5 20 50 100
tuesday apple 11 30 44 58 15
monday apple 1 668 10 78 896
my file is much more complicated than this, I need a code to start with.
and these files contains variable number of "fruits" and "days" so i might need some loop to scan through the whole file
Thank you.