Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35
Default How do I ignore blank lines

Hi

I am reading data in from several text files and turning it into one text
file, sometimes I get blank lines inserted into my output file. My method
doesn't work. Any ideas please?

Thanks

Wendy

Do While Not EOF(1) ' Loop until end of file.
Line Input #1, textline ' Read line into variable.
If textline = "" End If
Else
If Left(fname, 5) = "APSNL" Then
Print #2, textline ' Print to the
Scunny file
Else
Print #3, textline ' Print to the
Hull file
End If

Loop
Close #1 ' Close Input file.
Kill pafname 'deletes Input file


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default How do I ignore blank lines

Untested, uncompiled:

Do While Not EOF(1) ' Loop until end of file.
Line Input #1, textline ' Read line into variable.
If textline = "" Then
'skip it
Else
If Left(fname, 5) = "APSNL" Then
Print #2, textline ' Print to the Scunny file
Else
Print #3, textline ' Print to the Hull file
End If
Loop

=====
Maybe...

if trim(textline) = "" then
'skip it

(Just in case there's a space character floating around.

I'd also do this kind of check:
If ucase(Left(fname, 5)) = "APSNL" Then
to make sure upper/lower case didn't make a difference.



Wendy wrote:

Hi

I am reading data in from several text files and turning it into one text
file, sometimes I get blank lines inserted into my output file. My method
doesn't work. Any ideas please?

Thanks

Wendy

Do While Not EOF(1) ' Loop until end of file.
Line Input #1, textline ' Read line into variable.
If textline = "" End If
Else
If Left(fname, 5) = "APSNL" Then
Print #2, textline ' Print to the
Scunny file
Else
Print #3, textline ' Print to the
Hull file
End If

Loop
Close #1 ' Close Input file.
Kill pafname 'deletes Input file


--

Dave Peterson
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
Ignore blank cells Angyl Excel Discussion (Misc queries) 4 October 30th 07 09:42 PM
ignore blank Naomi Excel Discussion (Misc queries) 1 December 1st 06 12:55 PM
ignore blank cells Leticia Excel Discussion (Misc queries) 3 February 27th 06 05:41 PM
How to ignore blank cells MattBeckwith Charts and Charting in Excel 10 February 19th 06 11:16 PM
how do you ignore blank cells Kerry Excel Discussion (Misc queries) 1 February 16th 05 01:55 PM


All times are GMT +1. The time now is 06:23 PM.

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

About Us

"It's about Microsoft Excel"