ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   can i automaticity sort data in a table (https://www.excelbanter.com/excel-worksheet-functions/177420-can-i-automaticity-sort-data-table.html)

Allan

can i automaticity sort data in a table
 
can i automaticity sort date in a table as i enter it row by row

Gary''s Student

can i automaticity sort data in a table
 
Lets say we are entering data in columns A, B, & C, one row at a time. After
entering the value in column C, we want the data to automatically re-sort by
column A.

Enter the following code in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Set t = Target
Set c = Range("C:C")
If Intersect(t, c) Is Nothing Then Exit Sub
Application.EnableEvents = False
Columns("A:C").Select
Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
t.Offset(1, -2).Select
Application.EnableEvents = True
End Sub


REMEMBER: the worksheet code area, not a standard module.
--
Gary''s Student - gsnu200770


"allan" wrote:

can i automaticity sort date in a table as i enter it row by row


Gord Dibben

can i automaticity sort data in a table
 
Just be very careful when entering data.

After you enter an incorrectly spelled string or wrong number and the autosort
takes place, it may be difficult to track the error.


Gord Dibben MS Excel MVP

On Thu, 21 Feb 2008 05:42:02 -0800, allan
wrote:

can i automaticity sort date in a table as i enter it row by row



Judy Rose

can i automaticity sort data in a table
 
In my scenario there are columns A through O where as a case gets added to
the monthly load it goes on the list columns a and b are entered, then it
comes in enter a date into column c then I start the process column D gets a
date, I have a sort indicator set up in a column to sort by 1 through 16, I
want the system to auto sort every time I change the sort indicator from 1
through to 16, based on your model do I change the "C" to the column with the
sort indicator?

Thank you for your help.
--
Judy Rose Cohen


"Gary''s Student" wrote:

Lets say we are entering data in columns A, B, & C, one row at a time. After
entering the value in column C, we want the data to automatically re-sort by
column A.

Enter the following code in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Set t = Target
Set c = Range("C:C")
If Intersect(t, c) Is Nothing Then Exit Sub
Application.EnableEvents = False
Columns("A:C").Select
Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
t.Offset(1, -2).Select
Application.EnableEvents = True
End Sub


REMEMBER: the worksheet code area, not a standard module.
--
Gary''s Student - gsnu200770


"allan" wrote:

can i automaticity sort date in a table as i enter it row by row



All times are GMT +1. The time now is 12:46 PM.

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