• Delete to end of line in Macro (W2K)

    Author
    Topic
    #384388

    I have a large file, over 3500 lines, where I need to screen out some information. All the information I need to screen out begins on a line with the first character being “)”, withou the quotes.
    Is there any way to write a macro to find every instance of the ) character and delete from there to the end of the line?

    I would not want to do this manually due to the large nature of the record.

    Jail Administrator Medical

    Viewing 0 reply threads
    Author
    Replies
    • #659240

      hi,

      without seeing a sample of your document i cannot guarantee 100% this will work, but try this:

      Sub DeleteBadLines()
      Application.ScreenUpdating = False
      Dim BadLine As Long
      With ActiveDocument
      For BadLine = .Paragraphs.Count To 1 Step -1
      If Left(.Paragraphs(BadLine).Range.Text, 1) = “)” Then
      .Paragraphs(BadLine).Range.Delete
      End If
      Next
      End With
      Application.ScreenUpdating = True
      End Sub

      greetings,

    Viewing 0 reply threads
    Reply To: Delete to end of line in Macro (W2K)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: