Rishek
07-05-2017, 12:51 PM
I am trying to clear all the cells BETWEEN two words, but currently, the Macro is also deleting the two words themselves. Here's what I have:
Sub ClearTechandOrch()
Dim lngStart As Long
Dim lngEnd As Long
Selection.HomeKey Unit:=wdStory
With Selection.Find
.ClearFormatting
.Wrap = wdFindStop
.MatchCase = False
.Text = "TECHNICAL ONSTAGE"
If .Execute = False Then
Exit Sub
End If
Selection.Collapse Direction:=wdCollapseEnd
lngStart = Selection.End
.Text = "MUSIC STAFF"
If .Execute = False Then
Exit Sub
End If
lngEnd = Selection.Start
End With
ActiveDocument.Range(lngStart, lngEnd).Select
Selection.Delete Unit:=wdCharacter, Count:=1
End Sub
The Table is in the format:
TECHNICAL ONSTAGE
clear this row
clear
clear
clear
clear this row
clear this row
clear
clear
clear
MUSIC STAFF and some other text
Any help appreciated.
Sub ClearTechandOrch()
Dim lngStart As Long
Dim lngEnd As Long
Selection.HomeKey Unit:=wdStory
With Selection.Find
.ClearFormatting
.Wrap = wdFindStop
.MatchCase = False
.Text = "TECHNICAL ONSTAGE"
If .Execute = False Then
Exit Sub
End If
Selection.Collapse Direction:=wdCollapseEnd
lngStart = Selection.End
.Text = "MUSIC STAFF"
If .Execute = False Then
Exit Sub
End If
lngEnd = Selection.Start
End With
ActiveDocument.Range(lngStart, lngEnd).Select
Selection.Delete Unit:=wdCharacter, Count:=1
End Sub
The Table is in the format:
TECHNICAL ONSTAGE
clear this row
clear
clear
clear
clear this row
clear this row
clear
clear
clear
MUSIC STAFF and some other text
Any help appreciated.