A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

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



 
 
Thread Tools Display Modes
  #1  
Old March 9th, 2009, 05:08 PM posted to microsoft.public.excel.newusers
Larry
external usenet poster
 
Posts: 464
Default How can I insert a earlier date and sort it chronologicaly?

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.
  #2  
Old March 9th, 2009, 05:41 PM posted to microsoft.public.excel.newusers
Gord Dibben
external usenet poster
 
Posts: 20,252
Default How can I insert a earlier date and sort it chronologicaly?

DataSort

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

On Mon, 9 Mar 2009 10:08:01 -0700, larry
wrote:

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.


  #3  
Old March 10th, 2009, 03:11 PM posted to microsoft.public.excel.newusers
Shane Devenshire
external usenet poster
 
Posts: 845
Default How can I insert a earlier date and sort it chronologicaly?

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.
--
If this helps, please click the Yes button.

Cheers,
Shane Devenshire


"larry" wrote:

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.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:04 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.