Sorting dataset automatically after entering data in a row [or cel

G

Guest

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].
 
R

Ron de Bruin

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
 
R

Ron de Bruin

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 said:
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 said:
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].
 
G

Guest

Many thanks... I will give that a shot.

Ron de Bruin said:
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 said:
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 said:
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].
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top