ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Automatic Numbering (https://www.excelbanter.com/excel-worksheet-functions/187206-automatic-numbering.html)

Jodi

Automatic Numbering
 
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!

Roger Govier[_3_]

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!




All times are GMT +1. The time now is 04:37 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com