How can I insert a earlier date and sort it chronologicaly?

  • Thread starter Thread starter larry
  • Start date Start date
L

larry

I am using a template form and in my date column (B, 10-199) I wish to enter
an earlier date into the last row and have it sort to its' chronological
place in the column, i.e. say enter a Feb date after a March date and have it
in its logical spot in my date column.
 
Data>Sort

But, I think you want it to be "automatic" as you enter a new date.

I do not recommend this. In the case of an error, very difficult to find
the error after the sort.

If you want to autosort there is VBA code available.

See this google search result for Sandy Mann code to autosort.

http://tinyurl.com/39p64f


Gord Dibben MS Excel MVP
 
Hi,

Here is some sample code:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim isect As Range
Set isect = Application.Intersect(Target, Range("B10:B100"))
If Not isect Is Nothing Then
'Your code here
End If
End Sub

You should record the Data, Sort command and then stick the results into the
"Your code here" location. For example you might get something like

Range("B10:B100").Sort Key1:=Range("B10"), Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, _
DataOption1:=xlSortTextAsNumbers

1. To add this code to your file, press Alt+F11,
2. In the VBAProject window, top left side, find your sheet name under your
file name and double click it.
3. Paste in or type the code above.
 
Back
Top