View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Roger Govier[_3_] Roger Govier[_3_] is offline
external usenet poster
 
Posts: 2,480
Default Automatic Numbering

Hi Jodi

I can't think of a way to do it by formula, but the following macro might
help

Sub SortTasks()
Dim lr As Long
lr = Cells(Rows.Count, "A").End(xlUp).Row
Columns("A:B").Sort Key1:=Range("B1"), Order1:=xlAscending,
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Range("B1") = 1: Range("B2") = 2
Range("B1:B2").AutoFill Destination:=Range("B1:B" & lr)
End Sub

To insert the macro into your workbook.
Alt+F11 to invoke the VB Editor
InsertModule
Copy code above and Paste into white pane that appears
Alt+F11 to return to Excel

To use
Alt+F8 to bring up list of Macros
Highlight SortTasksRun

You could give it a shortcut key if you wanted.
ToolsMacroshighlight SortTasksOptionsenter a letter in the box to be
used in conjunction with Control, say qOK
Now when you want to run the macro, just type Control+q and it will run.

--
Regards
Roger Govier

"Jodi" wrote in message
...
I use an excel spreadsheet to prioritise tasks during my work day.

Sometimes I change the priority of my tasks (I have a separate column for
the priority number).

As it stands, whenever I change a number, e.g. priority 2 to priority 4 -
I
have to then go and re-number every other task on my list.

Is there a way of automatically changing the numbers so that I don't have
to
manually do this?

If there is a formula you could give me, that would be fantastic. Thanks
so
much!