Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Mar 2003
    Posts
    191
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Deleting certain rows (2003)

    Hi all,
    I have a spreadsheet that I want to delete certain rows from.
    I would like to select the whole spreadsheet and delete every row with the words "Travel Time" in it, no matter where in the row it appears.
    Is this possible?
    Thanks heaps.

    Bill

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Deleting certain rows (2003)

    You could run this macro:

    Sub DeleteRows()
    Const strText = "Travel Time"
    Dim rng As Range
    Set rng = Cells.Find(What:=strText, LookIn:=xlValues, LookAt:=xlWhole)
    Do While Not rng Is Nothing
    rng.EntireRow.Delete
    Set rng = Cells.FindNext
    Loop
    End Sub

    The code looks for cells whose value equals "Travel Time". If you want to look for cells whose value contains "Travel Time" plus possibly other text, change xlWhole to xlPart.

  3. #3
    2 Star Lounger
    Join Date
    Mar 2003
    Posts
    191
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Deleting certain rows (2003)

    Perfect! Thanks so much Hans.

    Bill

Posting Permissions

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