#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35
Default Remove Headers

I have a 125 files combined into 1 file. As a result the combined file has
headers all over. The data line starts with a "*" and the headers start with
a "!". How do I step through the file and delete all the headers except the
1st one? Please help.

Thanks
Hilton


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 287
Default Remove Headers

Hilton,

Can you sort your whole file by the field starting with ! and then delete
out all the repeating headers except for one?

"Hilton" wrote:

I have a 125 files combined into 1 file. As a result the combined file has
headers all over. The data line starts with a "*" and the headers start with
a "!". How do I step through the file and delete all the headers except the
1st one? Please help.

Thanks
Hilton



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Remove Headers

Can you select the column with the headers and then apply
data|Filter|autofilter.

Then filter to show those rows that start with !

Exclude the first row and select the rest. Then delete those visible rows.

Hilton wrote:

I have a 125 files combined into 1 file. As a result the combined file has
headers all over. The data line starts with a "*" and the headers start with
a "!". How do I step through the file and delete all the headers except the
1st one? Please help.

Thanks
Hilton


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35
Default Remove Headers

Apologies, it is a text file and too big too fit into excel. I probably
require a VBA macro.

"Dave Peterson" wrote in message
...
Can you select the column with the headers and then apply
data|Filter|autofilter.

Then filter to show those rows that start with !

Exclude the first row and select the rest. Then delete those visible

rows.

Hilton wrote:

I have a 125 files combined into 1 file. As a result the combined file

has
headers all over. The data line starts with a "*" and the headers start

with
a "!". How do I step through the file and delete all the headers except

the
1st one? Please help.

Thanks
Hilton


--

Dave Peterson



  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Remove Headers

Or some other text editor.

But if you want to try a macro...

Option Explicit
Sub testme01()

Dim TextLine As String
Dim FirstExPt As Boolean
Dim KeepThisRecord As Boolean
Dim iRecCount As Long
Dim oRecCount As Long

'my test files
Open "c:\my documents\excel\book4.txt" For Input As #1
Open "c:\my documents\excel\book4.txt.out" For Output As #2

iRecCount = 0
oRecCount = 0
FirstExPt = True
Do While Not EOF(1)
Line Input #1, TextLine
iRecCount = iRecCount + 1
KeepThisRecord = True
If Left(TextLine, 1) = "!" Then
If FirstExPt = True Then
FirstExPt = False
Else
KeepThisRecord = False
End If
End If

If KeepThisRecord = True Then
Print #2, TextLine
oRecCount = oRecCount + 1
End If
Loop

Close #1
Close #2

MsgBox "Recs In: " & iRecCount & vbLf & "Recs Out: " & oRecCount

End Sub

Change the file names/locations to match

Hilton wrote:

Apologies, it is a text file and too big too fit into excel. I probably
require a VBA macro.

"Dave Peterson" wrote in message
...
Can you select the column with the headers and then apply
data|Filter|autofilter.

Then filter to show those rows that start with !

Exclude the first row and select the rest. Then delete those visible

rows.

Hilton wrote:

I have a 125 files combined into 1 file. As a result the combined file

has
headers all over. The data line starts with a "*" and the headers start

with
a "!". How do I step through the file and delete all the headers except

the
1st one? Please help.

Thanks
Hilton


--

Dave Peterson


--

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
& in headers Dave F Excel Discussion (Misc queries) 3 January 22nd 07 06:24 PM
Headers PJ Excel Discussion (Misc queries) 1 December 28th 06 11:09 PM
headers Aamir Excel Worksheet Functions 1 November 13th 06 07:57 PM
How do I remove outlook headers from my excel worksheet? mishti Excel Discussion (Misc queries) 2 May 15th 05 12:36 PM
remove bold from cell ref headers Angiew Excel Discussion (Misc queries) 1 January 22nd 05 01:09 AM


All times are GMT +1. The time now is 02:09 AM.

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"