View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Paul Mathews Paul Mathews is offline
external usenet poster
 
Posts: 84
Default 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