Deleting redundant lines
- From: Spotty Boy <don.roach@xxxxxxxxxxxxx>
- Date: Thu, 5 Jun 2008 14:26:49 -0700 (PDT)
Hi,
Have the following kind of automated listings. Need to eliminate the
duplicate time entries. Can't figure out how to compare current time
to the previous time. See my preliminary macro at the end. There can
be weeks of this. The macro gets no errors. Please no laughing out
loud or snorting. However, snickering is OK ...
What Is:
--------------
BREAKFAST
07:00
Place orders
07:00
Handout activity lists
07:00
Assign jobs
LUNCH
12:00
Place orders
12:00
Discuss progress
12:00
Record problems
What I Need:
--------------
BREAKFAST
07:00
Place orders
Handout activity lists
Assign jobs
LUNCH
12:00
Place orders
Discuss progress
Record problems
Macro
--------------
Sub deldupes()
'
' Delete duplicate time entries
'
'Dim prevText As String
'
Selection.Find.MatchWildcards = True
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
'
With Selection.Find
.Text = "([0-9])([0-9])(:)([0-9])([0-9])"
.Replacement.Text = "\1\2\3\4\5"
.Forward = True
.Wrap = wdFindContinue
End With
'
If Selection.Text = prevText Then
Selection.Find.Replacement.Text = ""
End If
'
prevText = Selection.Text
'
Selection.Find.Execute Replace:=wdReplaceAll
'
End Sub
.
- Follow-Ups:
- Re: Deleting redundant lines
- From: Doug Robbins - Word MVP
- Re: Deleting redundant lines
- Prev by Date: Re: Inserting footnote into automated word document from Access
- Next by Date: Re: Deleting redundant lines
- Previous by thread: Inserting footnote into automated word document from Access
- Next by thread: Re: Deleting redundant lines
- Index(es):