Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 159
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   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 857
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.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do I subtract time from a date to get an earlier date? Sunny_Dreams Excel Discussion (Misc queries) 5 February 11th 09 05:58 PM
Deriving an earlier date based on a later date Bob Excel Worksheet Functions 7 February 14th 08 02:33 PM
How can I insert a date with an icon (calendar) insert Alfredo Mederico[_2_] Excel Discussion (Misc queries) 4 September 21st 07 01:20 AM
How do I format an Excel date earlier than 1900? LeoTernes Excel Worksheet Functions 1 January 26th 06 08:37 AM
How do I replace dates earlier than certain date? Jose Martinez Excel Discussion (Misc queries) 4 April 29th 05 09:50 PM


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

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

About Us

"It's about Microsoft Excel"