Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I have an excel list with 9 columns, the first heading is date, the last is total. I need to enter a batch of records into separate rows under the headings, with each record having a different date. Is there any way that the entire list could be sorted by date every time I press enter after entering all the data in the list (I dont want to click the A to Z icon each row or at the end of data entry if possible. Note: the last column sums several cells within the data record. Thanks for any help on this. Craig |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Assuming headers are in row1, a1:I1
Right click on sheet tab and select view code. put in code similar to this: Private Sub Worksheet_Change(ByVal Target As Range) If Target.Count 1 Then Exit Sub On Error GoTo ErrHandler If IsEmpty(Target) Then Exit Sub If Target.Column = 9 Then Application.EnableEvents = False Set rng1 = Range("A1").CurrentRegion Set rng1 = rng.Resize(rng1.Rows.Count - 1) rng1.Sort Key1:=Range("A1"), Order1:=xlAscending, _ Header:=xlYes End If ErrHandler: Application.EnableEvents = True End Sub -- Regards, Tom Ogilvy "Craig" wrote in message ... Hi, I have an excel list with 9 columns, the first heading is date, the last is total. I need to enter a batch of records into separate rows under the headings, with each record having a different date. Is there any way that the entire list could be sorted by date every time I press enter after entering all the data in the list (I dont want to click the A to Z icon each row or at the end of data entry if possible. Note: the last column sums several cells within the data record. Thanks for any help on this. Craig |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you Tom...I put in this exact code into the code window and tried but
it did not automatically sort the list after I pressed enter in column I. Any thoughts? Appreciate any help...thanks very much Craig "Tom Ogilvy" wrote: Assuming headers are in row1, a1:I1 Right click on sheet tab and select view code. put in code similar to this: Private Sub Worksheet_Change(ByVal Target As Range) If Target.Count 1 Then Exit Sub On Error GoTo ErrHandler If IsEmpty(Target) Then Exit Sub If Target.Column = 9 Then Application.EnableEvents = False Set rng1 = Range("A1").CurrentRegion Set rng1 = rng.Resize(rng1.Rows.Count - 1) rng1.Sort Key1:=Range("A1"), Order1:=xlAscending, _ Header:=xlYes End If ErrHandler: Application.EnableEvents = True End Sub -- Regards, Tom Ogilvy "Craig" wrote in message ... Hi, I have an excel list with 9 columns, the first heading is date, the last is total. I need to enter a batch of records into separate rows under the headings, with each record having a different date. Is there any way that the entire list could be sorted by date every time I press enter after entering all the data in the list (I dont want to click the A to Z icon each row or at the end of data entry if possible. Note: the last column sums several cells within the data record. Thanks for any help on this. Craig |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How 2 sort an autosum total list after adding items 2 autosum item | Excel Discussion (Misc queries) | |||
how to auto extract item# upon entering a date | Excel Discussion (Misc queries) | |||
Auto sort function for a list | Excel Discussion (Misc queries) | |||
How to Auto-populate cell based on selection of a list item | Excel Discussion (Misc queries) | |||
Excel Auto Filter: WHY'S SORT @ TOP OF LIST? WHEN I KEY TO "SHOW . | Excel Worksheet Functions |