Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 331
Default Sort by changing number

I was wondering if there is a way to change the order (sort) of a top 10 list
by changing any number in one column then have the higher numbers move down
one. For example:
Column A is contains numbers 1-10, Column B contains names. If I want to to
change a persons name who is number 8 to number 3, I would just change the
number in column A from 8 to 3 (press enter or tab out of the column) and the
entire row containing the number and name would appear in the number 3 spot
and all numbers and names would move down one. So what was 3 would now be 4,
what was 4 would become 5 all the way to number 10.
Thanks for you respones.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Sort by changing number

Greg,

Right click the sheet tab, view code and paste this in. Put the number where
you want the sort to start in C1 and columns A&B will be sorted with that
number at the top.

Sub VarySort()
Last = Range("A65536").End(xlUp).Row
With Range(Cells(1, 1), Cells(Last, 2))
.Sort Key1:=Range("A1"), Order1:=xlAscending
End With
For a = 1 To Last
If Left(Cells(a, 1).Value, 1) = Cells(1, 3).Value Then
Cutme = a
Exit For
End If
Next a
Range(Cells(1, 1), Cells(Cutme - 1, 2)).Cut Destination:=Cells(Last + 1,
1)
Last = Cells(Rows.Count, 1).End(xlUp).Row
Range(Cells(Cutme, 1), Cells(Last, 2)).Cut Destination:=Cells(1, 1)
End Sub


Mike


"Greg" wrote:

I was wondering if there is a way to change the order (sort) of a top 10 list
by changing any number in one column then have the higher numbers move down
one. For example:
Column A is contains numbers 1-10, Column B contains names. If I want to to
change a persons name who is number 8 to number 3, I would just change the
number in column A from 8 to 3 (press enter or tab out of the column) and the
entire row containing the number and name would appear in the number 3 spot
and all numbers and names would move down one. So what was 3 would now be 4,
what was 4 would become 5 all the way to number 10.
Thanks for you respones.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
sort an outline without changing the hierarchy lelisabeth Excel Discussion (Misc queries) 1 December 10th 07 07:57 PM
Sort a changing range jhyatt Excel Discussion (Misc queries) 0 September 18th 07 08:04 PM
Round number to the thousands without changing underlying number Tim Caldwell Excel Discussion (Misc queries) 3 June 13th 07 09:37 PM
Sort changing formulas David P. Excel Discussion (Misc queries) 2 May 13th 07 11:48 PM
Changing format of number without changing the value sweetsue516 Excel Discussion (Misc queries) 2 August 22nd 05 04:07 PM


All times are GMT +1. The time now is 09:40 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"