On Jul 5, 5:12*pm, Don Guillett Excel MVP <dguille...@austin.rr.com>
wrote:
> On Jul 4, 9:02*am, shriil <sanjib.lah...@gmail.com> wrote:
>
>
>
>
>
> > On Jul 4, 5:29*pm, Don Guillett Excel MVP <dguille...@austin.rr.com>
> > wrote:
>
> > > On Jul 4, 7:05*am, shriil <sanjib.lah...@gmail.com> wrote:
>
> > > > I have a data sheet where some date fields get populated as below (dd/
> > > > mm/yyyy format)
> > > > * * * * *A * * * * * * * * * *B
> > > > *03/04/2010 * * * * 04/05/2010
> > > > *15/05/2010 * * * * 17/05/2010
> > > > *20/04/2010 * * * * 23/04/2010
> > > > *01/06/2010 * * * * 02/06/2010
> > > > *12/05/2010 * * * * 18/05/2010
>
> > > > I would like to arrange all the dates in another column, say C, butin
> > > > an ascending manner
>
> > > > How do I go about it?
>
> > > > Thanks for the help
>
> > > Just copy each range to col c and SORT
>
> > Yes... I know that.. but as the data gets populated *from other
> > worksheets and goes on increasing in subsequent rows, I would want to
> > avoid any manual interventions like "copying and sorting" at every
> > instance of a new data. Instead it would be helpful if I could run a
> > code which selects the range in which data is present, sorts the same
> > and fills it in Column C.- Hide quoted text -
>
> > - Show quoted text -
>
> This should do it even if there are blanks in a & b
> Option Explicit
> Sub copyAandBtoCandSortSAS()
> Dim i As Double
> For i = 1 To 2 'columns
> *Range(Cells(1, i), Cells(Rows.Count, i).End(xlUp)).Copy _
> *Cells(Rows.Count, 3).End(xlUp).Offset(1)
> Next i
> Columns(3).Sort Key1:=Cells(1, 3), Order1:=xlAscending, _
> Header:=xlGuess, OrderCustom:=1, MatchCase:=False, _
> Orientation:=xlTopToBottom, DataOption1:=xlSortTextAsNumbers
> End Sub- Hide quoted text -
>
> - Show quoted text -
Thanks a lot. Shall try it out and give the feedback
|