PC Review


Reply
 
 
magix
Guest
Posts: n/a
 
      13th Dec 2005
Hi,

I want to check the column if it is sort ascendingly, if not, then will sort
it
How can I translate below into VBA code ?

If Column A is not sort ascendingly from A2 onward then
sort column A ascendingly from A2 onward
else
do something here.

Thanks.

Regards,
Magix


 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      13th Dec 2005
I wouldn't bother checking--just sort the range the way you want it.

I think that it would be easier/quicker than checking (and then possibly having
to sort).



magix wrote:
>
> Hi,
>
> I want to check the column if it is sort ascendingly, if not, then will sort
> it
> How can I translate below into VBA code ?
>
> If Column A is not sort ascendingly from A2 onward then
> sort column A ascendingly from A2 onward
> else
> do something here.
>
> Thanks.
>
> Regards,
> Magix


--

Dave Peterson
 
Reply With Quote
 
magix
Guest
Posts: n/a
 
      13th Dec 2005
Ok. I would just sort it.

What is the appropriate code ?
Worksheets("Sheet1").Range("A2").Sort
Key1:=Worksheets("Sheet1").Columns("A"), Header:=xlGuess ? How to set for
ascending order ?



"Dave Peterson" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I wouldn't bother checking--just sort the range the way you want it.
>
> I think that it would be easier/quicker than checking (and then possibly

having
> to sort).
>
>
>
> magix wrote:
> >
> > Hi,
> >
> > I want to check the column if it is sort ascendingly, if not, then will

sort
> > it
> > How can I translate below into VBA code ?
> >
> > If Column A is not sort ascendingly from A2 onward then
> > sort column A ascendingly from A2 onward
> > else
> > do something here.
> >
> > Thanks.
> >
> > Regards,
> > Magix

>
> --
>
> Dave Peterson



 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      13th Dec 2005
Record a macro when you select the range and sort the data based on the field
you want (in ascending order).

The recorded code will work nicely.

magix wrote:
>
> Ok. I would just sort it.
>
> What is the appropriate code ?
> Worksheets("Sheet1").Range("A2").Sort
> Key1:=Worksheets("Sheet1").Columns("A"), Header:=xlGuess ? How to set for
> ascending order ?
>
> "Dave Peterson" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > I wouldn't bother checking--just sort the range the way you want it.
> >
> > I think that it would be easier/quicker than checking (and then possibly

> having
> > to sort).
> >
> >
> >
> > magix wrote:
> > >
> > > Hi,
> > >
> > > I want to check the column if it is sort ascendingly, if not, then will

> sort
> > > it
> > > How can I translate below into VBA code ?
> > >
> > > If Column A is not sort ascendingly from A2 onward then
> > > sort column A ascendingly from A2 onward
> > > else
> > > do something here.
> > >
> > > Thanks.
> > >
> > > Regards,
> > > Magix

> >
> > --
> >
> > Dave Peterson


--

Dave Peterson
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to sort without including column headings in sort OPDvolunteer Microsoft Excel Misc 4 11th Mar 2009 04:08 PM
Auto-Sort Won't Sort All Column Cells TikiTembo Microsoft Excel Misc 1 25th Mar 2008 07:00 PM
data, sort option is grayed. how to sort on a column? Steve Richter Microsoft Excel Misc 1 25th Sep 2007 03:25 PM
Crosstab Query: Sort Column heading based on other column sort Kaur Microsoft Access Reports 7 23rd Dec 2005 06:10 PM
How can I sort one column and have the entire row sort. (binding) =?Utf-8?B?Qmx1ZQ==?= Microsoft Excel Worksheet Functions 10 13th Nov 2005 07:09 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:44 AM.