Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
& in headers | Excel Discussion (Misc queries) | |||
Headers | Excel Discussion (Misc queries) | |||
headers | Excel Worksheet Functions | |||
How do I remove outlook headers from my excel worksheet? | Excel Discussion (Misc queries) | |||
remove bold from cell ref headers | Excel Discussion (Misc queries) |