Thread: data on top
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default data on top

Select your list and run:

Sub smith()
Dim savit()
ReDim savit(Selection.Count)
i = 0
foundit = False
For Each r In Selection
With r
If .Value = "smith" Then
foundit = True
Else
savit(i) = .Value
i = i + 1
End If
End With
Next

If foundit Then
i = 0
j = 0
For Each r In Selection
If j = 0 Then
Selection.Cells(1) = "smith"
j = 1
Else
r.Value = savit(i)
i = i + 1
End If
Next
End If
End Sub
--
Gary''s Student - gsnu2007


" wrote:

hello ,

can anyone help with this,


i have series of data segregated like this

example:

richard
kenny
smith
john
raju

i want the output like this . i want smith to be positioned in the
first place always and should not be repeated

it should be like this

smith
richard
kenny
john
raju

can anyone help me with a formula

thans