View Full Version : COUNTING
oleg_v
09-15-2010, 07:43 AM
hI
i need help with macro to count numbers of lines in the
text file and then delete line number 62 and then every line +60 lines
thanks
Bob Phillips
09-15-2010, 08:44 AM
The code I gave you earlier showed you how to read a text file and output to another. Just add a counter and when you get to 62, don't write it. Then every 60 thereafter don't write.
oleg_v
09-16-2010, 01:58 AM
hi
i want to ask another question regarding the same issue
how can i prevent the copy of the next line after special value.
i can manage with the searching of the value but the prevention i am stuck
thanks.
Bob Phillips
09-16-2010, 03:43 AM
What you need to do is open the file once as input, and a new file as output. Read each line of input and write to output. If you want to insert a line, just write it to output. If you want to delete a line, don't write it at all.
Finally, kill the input file and rename the output file.
It is all in that previous example, just need to tweak it to your circumstances.
oleg_v
09-16-2010, 04:34 AM
thanks for everything
i succeeded but still i can not find the way
if 2 continues lines are the same do not write them
thanks
Bob Phillips
09-16-2010, 05:47 AM
Post your workbook and input file, and highlight which lines should not be copied.
oleg_v
09-16-2010, 05:58 AM
Hi
you can see in the input file
that if there is 2 lines one after anther looking like
"--------------------------------------------------------------------------------"
those 2 lines should not be copied.
but if after 1 line there is some thing else it ok to copy.
thanks
sorry i could not highlight those lines.
Oleg
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.