Results 1 to 2 of 2
  1. #1
    Star Lounger
    Join Date
    Apr 2001
    Location
    Oklahoma City, Oklahoma, USA
    Posts
    54
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Delete to end of line in Macro (W2K)

    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

  2. #2
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Brussels, Brussel, Belgium
    Posts
    159
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Delete to end of line in Macro (W2K)

    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,

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •