I want to use VBA to 1) Find the word “Report:” in my excel sheet (I know the word “Report:” will only appear once in the sheet); 2) Erase all the content (including the word “Report”) below this cell
So, ideally, the result should look like this:
The amount of data will change, so the word “Report:” is not going to be in the row 109 every time.
This is the code I am using now,
Sub Trial()
Set myRange = ActiveDocument.Content
myRange.Find.Execute FindText:="Report:", _
Forward:=True
If myRange.Find.Found = True Then
myRange.SetRange (myRange.End + 1), ActiveDocument.Content.End
myRange.Delete
End If
End Sub
But, it gives me a
run-time error ‘424’