+ Reply to Thread
Results 1 to 2 of 2

Thread: Macro for Row Processing

  1. #1
    George
    Guest

    Macro for Row Processing

    Can somebody please help this newbie

    Each cell in A1:A10 contains an integer in descending order i.e. the highest
    in row 1.

    The integer in any row may be the same as the one above or below :e.g.:-

    a1 = 34
    a2 = 34
    a3 = 32
    a4 = 31
    a5 = 31
    a6 = 31
    a7 = 25
    a8 = 20
    a9 = 20
    a10 = 18

    I need a macro that will remove duplicates and pull up the next highest
    value to end up with :-

    a1=34
    a2=32
    a3=31
    a4=25
    a5=20
    a6=18

    Please note that I do not want to delete rows containing duplicates as I
    also need to repeat the whole process on B1:B10 and up to G1:G10 - all of
    which contain
    other (i.e. different) integers. Consequently, I would like to include that
    feature in the macro.


    Many thanks

    George



  2. #2
    Paul Mathews
    Guest

    RE: Macro for Row Processing

    Hi George, try this:

    Sub MakeUniqueList()
    'Create a list of unique items from an original data list whose
    'first value occupies cell A1

    Range("A1").Select

    Do Until ActiveCell.Value = ""
    If ActiveCell.Offset(1, 0).Value = ActiveCell.Value Then
    Selection.Delete Shift:=xlUp
    Else
    ActiveCell.Offset(1, 0).Select
    End If
    Loop

    End Sub

    "George" wrote:

    > Can somebody please help this newbie
    >
    > Each cell in A1:A10 contains an integer in descending order i.e. the highest
    > in row 1.
    >
    > The integer in any row may be the same as the one above or below :e.g.:-
    >
    > a1 = 34
    > a2 = 34
    > a3 = 32
    > a4 = 31
    > a5 = 31
    > a6 = 31
    > a7 = 25
    > a8 = 20
    > a9 = 20
    > a10 = 18
    >
    > I need a macro that will remove duplicates and pull up the next highest
    > value to end up with :-
    >
    > a1=34
    > a2=32
    > a3=31
    > a4=25
    > a5=20
    > a6=18
    >
    > Please note that I do not want to delete rows containing duplicates as I
    > also need to repeat the whole process on B1:B10 and up to G1:G10 - all of
    > which contain
    > other (i.e. different) integers. Consequently, I would like to include that
    > feature in the macro.
    >
    >
    > Many thanks
    >
    > George
    >
    >
    >


+ 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.2.0