Column Sort

  • Thread starter Thread starter magix
  • Start date Start date
M

magix

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
 
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).
 
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 ?
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top