How can I get a worksheet to sort automatically by a certain column? When I add a new row, one of the columns will be a date. I would like the sheet to automatically sort my new entry in the correct spot.
Also, anyone know of any good (beginner) tutorials for Excel online? I know Excel can do a lot but am having difficulty figuring it out.
Okay, this involves VBA code. This assumes four columns, and the Date is in Column B, with actual dates beginning in B2.
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 2 Then 'if column B gets changed
With Range("A1:D" & Range("D65536").End(xlUp).Row)
.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
To place this code, right-click on the worksheet tab (bottom of the worksheet), then choose "View Code". This will open the Visual Basic Editor (VBE) window. Then paste this into that window.
Then go back to your sheet and begin entering data. Make sure that the Date column is formatted as date (choose whatever Date format you want).
[EDIT: Corrected the column number and column reference in second line of code.]
Last edited by shades; 09-17-04 at 16:54.
old, slow, and confused
but at least I'm inconsistent!