Sorting dataset automatically after entering data in a row [or cel
If I have a spreadsheet with four column, and rows starting at row 2 [headings are in row 1], and increasing daily. One of the columns is a "priority" column, which is 1 [for the highest] down to 5 [for lowest]. I'd like to sort the data each time a new row is entered, such that the highest priorities are listed first. Is there a way for this to happen automatically? Or would I have to, at the least, create a Macro and put that button on the toolbar to press when I want a sort to take place? Any help would be greatly appreciated. Thanks. m [I apologize that this accidentally went in the FrontPage forum as well... sorry about that]. |
Sorting dataset automatically after entering data in a row [or cel
Hi MatthewS
You can use the change event in the sheet module to sort when you enter a value in column A Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 1 Then Range("A:A").Sort Key1:=Range("A2"), Order1:=xlAscending, Header:= _ xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _ DataOption1:=xlSortNormal End If End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "MatthewS" wrote in message ... If I have a spreadsheet with four column, and rows starting at row 2 [headings are in row 1], and increasing daily. One of the columns is a "priority" column, which is 1 [for the highest] down to 5 [for lowest]. I'd like to sort the data each time a new row is entered, such that the highest priorities are listed first. Is there a way for this to happen automatically? Or would I have to, at the least, create a Macro and put that button on the toolbar to press when I want a sort to take place? Any help would be greatly appreciated. Thanks. m [I apologize that this accidentally went in the FrontPage forum as well... sorry about that]. |
Sorting dataset automatically after entering data in a row [or cel
Oops
Change this to your columns If your data is in A:Z use Range("A:Z").Sort................................. . -- Regards Ron de Bruin http://www.rondebruin.nl "Ron de Bruin" wrote in message ... Hi MatthewS You can use the change event in the sheet module to sort when you enter a value in column A Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 1 Then Range("A:A").Sort Key1:=Range("A2"), Order1:=xlAscending, Header:= _ xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _ DataOption1:=xlSortNormal End If End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "MatthewS" wrote in message ... If I have a spreadsheet with four column, and rows starting at row 2 [headings are in row 1], and increasing daily. One of the columns is a "priority" column, which is 1 [for the highest] down to 5 [for lowest]. I'd like to sort the data each time a new row is entered, such that the highest priorities are listed first. Is there a way for this to happen automatically? Or would I have to, at the least, create a Macro and put that button on the toolbar to press when I want a sort to take place? Any help would be greatly appreciated. Thanks. m [I apologize that this accidentally went in the FrontPage forum as well... sorry about that]. |
Sorting dataset automatically after entering data in a row [or
Many thanks... I will give that a shot.
"Ron de Bruin" wrote: Oops Change this to your columns If your data is in A:Z use Range("A:Z").Sort................................. . -- Regards Ron de Bruin http://www.rondebruin.nl "Ron de Bruin" wrote in message ... Hi MatthewS You can use the change event in the sheet module to sort when you enter a value in column A Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 1 Then Range("A:A").Sort Key1:=Range("A2"), Order1:=xlAscending, Header:= _ xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _ DataOption1:=xlSortNormal End If End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "MatthewS" wrote in message ... If I have a spreadsheet with four column, and rows starting at row 2 [headings are in row 1], and increasing daily. One of the columns is a "priority" column, which is 1 [for the highest] down to 5 [for lowest]. I'd like to sort the data each time a new row is entered, such that the highest priorities are listed first. Is there a way for this to happen automatically? Or would I have to, at the least, create a Macro and put that button on the toolbar to press when I want a sort to take place? Any help would be greatly appreciated. Thanks. m [I apologize that this accidentally went in the FrontPage forum as well... sorry about that]. |
All times are GMT +1. The time now is 09:19 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com