VB sorting keeps expanding the range

CalvinGraham

Board Regular
Joined
Jan 27, 2010
Messages
67
So I've got a function that moves values between two columns. I thought that the quickest way would be to add the value at the bottom of it, expand the range by one row and call the built in sort function:
EndRange.Sort Key1:=EndRange.Cells(1), Order1:=xlAscending, Header:=xlNo
Unfortunately it keeps expanding the range to other nearby data. The other nearby data is the selection index and the "<All values>" bit at the top and the (the range feeds a listbox) so I can't simply seperate the data that easily

Is there some way to force Excel to not expand the sort range area?
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

Forum statistics

Threads
1,224,609
Messages
6,179,882
Members
452,948
Latest member
Dupuhini

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