+ Reply to Thread
Results 1 to 2 of 2

[SOLVED] Delete row containing all previous values.

  1. #1
    mohd21uk via OfficeKB.com
    Guest

    [SOLVED] Delete row containing all previous values.

    I have a column in a spreadsheet with repeated values for e.g a name which
    is repeated 5 times I would like to keep the last row containing this value
    but delete all previous rows i.e in this example i would like to keep row
    five containing the last occourence of this value and delete all previous
    rows.

    --
    Message posted via OfficeKB.com
    http://www.officekb.com/Uwe/Forums.a...l-new/200605/1

  2. #2
    Don Guillett
    Guest

    Re: Delete row containing all previous values.

    try this

    Sub deleledupsinpreviousrows()
    For i = Cells(Rows.Count, "a").End(xlUp).Row To 2 Step -1
    If Cells(i - 1, 1) = Cells(i, 1) Then Rows(i - 1).Delete
    Next
    End Sub

    --
    Don Guillett
    SalesAid Software
    [email protected]
    "mohd21uk via OfficeKB.com" <u20517@uwe> wrote in message
    news:6008940b2b634@uwe...
    >I have a column in a spreadsheet with repeated values for e.g a name which
    > is repeated 5 times I would like to keep the last row containing this
    > value
    > but delete all previous rows i.e in this example i would like to keep row
    > five containing the last occourence of this value and delete all previous
    > rows.
    >
    > --
    > Message posted via OfficeKB.com
    > http://www.officekb.com/Uwe/Forums.a...l-new/200605/1




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1