Another Sort Macro please

lapta301

Well-known Member
Joined
Nov 12, 2004
Messages
1,001
Office Version
  1. 365
Platform
  1. Windows
Hi All

I have an ever changing block of data that including headers covers the range A1 to AM500

Column A will always have data in it but AM column will not always but it will be the final column in the range.

What I would like is a macro that will sort the range from A1 to whatever the final row is and along to column AM by the values in column B.

But there is a complication.

There is another block of data that will be below the range that I want to sort so the code will need to go down from A1 to find the last row rather than coming up from the bottom.

I hope that this makes sense.

As ever your help is most appreciated.
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
One simple way to identify the region around A1 that has data is to use range("a1").currentregion.
Hi All

I have an ever changing block of data that including headers covers the range A1 to AM500

Column A will always have data in it but AM column will not always but it will be the final column in the range.

What I would like is a macro that will sort the range from A1 to whatever the final row is and along to column AM by the values in column B.

But there is a complication.

There is another block of data that will be below the range that I want to sort so the code will need to go down from A1 to find the last row rather than coming up from the bottom.

I hope that this makes sense.

As ever your help is most appreciated.
 
Upvote 0
tusharm

Thanks for pointing me in that direction I'll give it a try shortly.

Regards

lapta301
 
Upvote 0
tusharm

That works great thank you.

However in thinking about how often I can use this I can see a minor problem on the horizon.

So if for example the currentregion is A1 to AM500 is there a way to take a row off and make it 499 or whatever.

Many thanks
 
Upvote 0
You can always resize a range as required. Check out Excel VBA help for Resize.
tusharm

That works great thank you.

However in thinking about how often I can use this I can see a minor problem on the horizon.

So if for example the currentregion is A1 to AM500 is there a way to take a row off and make it 499 or whatever.

Many thanks
 
Upvote 0
tusharm

Thank you again for directions which again work a treat.

Kind regards from a sometimes very wet and sometimes very sunny Southern England.
 
Upvote 0

Forum statistics

Threads
1,207,438
Messages
6,078,561
Members
446,349
Latest member
Malroos7912

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top