#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Updating Rank

I have a spreadsheet with column A ranking the info 1-100 for priority. How
can I change a row to move to the top and re-rank the rest? The best example
I have seen of this is your netflix queue where you ask it to move a
selection to the top or re-rank numbers by changing where you want them in
the queue. I hope this makes sense. Thanks!!
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Updating Rank

Thanks Luke it worked like a charm. Is there a way to automate so that once
the numbers change, it would then sort again so 1 is at the top???
Your my Hero!

"Luke M" wrote:

'Right click on sheet tab, view code, paste this in:

'=====================================
Private Sub Worksheet_Change(ByVal Target As Range)
'Define Range that will be changed
If Intersect(Target, Range("A1:A100")) Is Nothing Or _
Target.Count 1 Then Exit Sub
Application.EnableEvents = False
'What is the new rank?
NewValue = Target.Value
Application.Undo
'What was the old rank?
OldValue = Target.Value

'Start re-ranking process
Target.Value = NewValue
For Each cell In Range("A1:A100")
'Find out if the rank needs to change
If cell.Value = NewValue And _
Intersect(cell, Target) Is Nothing And _
cell.Value < OldValue Then
'If needed, move down in rank
cell.Value = cell.Value + 1
End If
Next cell
Application.EnableEvents = True
End Sub
'==========================

Exit out of the VBE, and your workbook should be good to go. Note that this
only works for INCREASING the rank, not decreasing.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"NSI Lynsy" wrote:

I have a spreadsheet with column A ranking the info 1-100 for priority. How
can I change a row to move to the top and re-rank the rest? The best example
I have seen of this is your netflix queue where you ask it to move a
selection to the top or re-rank numbers by changing where you want them in
the queue. I hope this makes sense. Thanks!!

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
rank the numbers / range of data using 'RANK' and 'ABS' KP Excel Worksheet Functions 1 March 8th 08 05:50 PM
RANK, duplicate ranking but no gaps in rank arron laing Excel Worksheet Functions 4 June 14th 06 07:57 AM
Rank where lowest value is highest rank mile3024 Excel Worksheet Functions 2 December 9th 05 10:57 PM
Does Correl/Rank combo work eg CORREL(cols E & H) where E&H=RANK(. Emmanuel Excel Worksheet Functions 3 November 12th 05 03:33 PM
Rank items, select one start date, have remaining dates follow based on rank rob normerica Excel Discussion (Misc queries) 1 August 15th 05 09:36 PM


All times are GMT +1. The time now is 08:36 AM.

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

About Us

"It's about Microsoft Excel"