sort whole ranges based on selection multiple cells at once without any criteria

abdo meghari

Well-known Member
Joined
Aug 3, 2021
Messages
651
Office Version
  1. 2019
Hi experts ,
I no know if this way could be sort it !

I want to sort the data based on my choices, where the data will be arranged based on who will be selected first for cells in column A , then the next based on the selection of a cell or several cells at the same time. In this case, it will be arranged in an orderly manner and if I select new data are not selected before then will copy directly to below data have already selected and sorted . And in the case of choosing the same elements that were previously organized, then they are organized again and make the ones below them rise to the top

original data
Elmarghanie Brand .xlsm
ABCDE
1ITEMCODEBRANDPURCHASESELLING
21CCR-1220BS 1200 R20 18PR G580 THI20
32CCR-1221BS 1200 R20 18PR G580 JAP30471
43CCR-1222BS 1200R20-18PR R187 JAP9
54CCR-1223BS 1200R24 G580508
65CCR-1224BS 1200R24 G5822
76CCR-1225BS 13 R22.5 R187 JAP4
87CCR-1226BS 1400R20 TCF R180 JAP2
98CCR-1227BS 1400R20 TCF R180BZ JAP4
109CCR-1211BS 1400R20VSJ TCF JAP2255
1110CCR-1212BS 165 R13C R624 IND44
1211CCR-1213BS 175/70R13 EP150 THI2
1312CCR-1214BS 185/65R15 B250 JAP2
1413CCR-1215BS 185/65R15 T001 JAP1
1514CCR-1216BS 195/75R16C R613 JAP6
1615CCR-1217BS 195R14C 613 JAP4
1716CCR-1218BS 195R14C R623 THI4
1817CCR-1219BS 195R15C 613V JAP44
1918CCR-1228BS 205/60R16 T005 THI8
2019CCR-1229BS 205/70R15C R623 THI8405
2120CCR-1230BS 205R16C D840 THI26
2221CCR-1231BS 215/50 R17 EP300 THI10
2322CCR-1232BS 215/55R17 T005 JAP4
2423CCR-1233BS 215/60R16 ER30 JAP88
2524CCR-1234BS 215/65R15 T005A IND44
2625CCR-1235BS 215/70R15C R624 HD109S107S 8 TURK6
2726CCR-1236BS 225/40R18PR 005A JAP8
2827CCR-1237BS 225/55R17 EP300 THI1
2928CCR-1238BS 225/55R17 T005A JAP8
3029CCR-1239BS 225/55R18 AL001 JAP4
3130CCR-1240BS 225/60R17 D-SPORT JAP15
3231CCR-1241BS 225/60R18 ALENZA001 JAP4
3332CCR-1242BS 225/70R15C R623 JAP8
3433CCR-1243BS 235/35ZR19 RE050A JAP4
3534CCR-1244BS 235/50R18 AL01 JAP8
3635CCR-1245BS 235/55R17 ER300 JAP8
3736CCR-1246BS 235/65R16C R660 TURK12
3837CCR-1247BS 245/40R18PR 050A JAP8
3938CCR-1248BS 245/40R19 T005 JAP4
4039CCR-1249BS 245/40ZR20 PSPORT JAP4
4140CCR-1250BS 245/45R17 T05A JAP4
4241CCR-1251BS 245/45R18 EP300 THI4
4342CCR-1252BS 245/45R19 T005A JAP4
4443CCR-1253BS 245/70R17 684A JAP2
4544CCR-1254BS 255/35R19 S001 JAP4
4645CCR-1255BS 255/50R20 AL001 JAP8
4746CCR-1256BS 255/70R15C D840 THI33
4847CCR-1257BS 265/55R20 D693 LCRUSER JAP4
4948CCR-1158BS 265/60R18 D840 JAP4
5049CCR-1159BS 265/65R17 D840 JAP4
5150CCR-1160BS 265/65R18 D693 JAP4
5251CCR-1161BS 265/70R16 D840 THI76
5352CCR-1162BS 275/35R21 RE21 JAP4
5453CCR-1163BS 275/65R18 AL01 JAP12
5554CCR-1164BS 285/60R18 DHPS JAP8
5655CCR-1165BS 285/65R17 R683 JAP8
5756CCR-1166BS 295/35R20 S001 JAP4
5857CCR-1167BS 315/80R22.5-18PR G580 JAP12
5958CCR-1168BS 315/80R22.5-18PR G582 THI12
6059CCR-1169BS 325/95 R24 M840 JAP62
6160CCR-1170BS 385/65 R22.5 R164 JAP4
6261CCR-1171BS 445/65R22.5 R164 JAP24
6362CCR-1172BS 650R16 R230 JAP8
6463CCR-1173BS 385/65 R22.5 R164 JAP16
6564CCR-1174BS 445/65R22.5 R164 JAP18
6665CCR-1175BS 650R16 R230 JAP20
REPORT

examples:
pic: select cells A15,A19,A23
1.PNG
View attachment 87306
to become like this
Elmarghanie Brand .xlsm
ABCDE
1ITEMCODEBRANDPURCHASESELLING
21CCR-1216BS 195/75R16C R613 JAP6
32CCR-1228BS 205/60R16 T005 THI8
43CCR-1232BS 215/55R17 T005 JAP4
54CCR-1220BS 1200 R20 18PR G580 THI20
65CCR-1221BS 1200 R20 18PR G580 JAP30471
76CCR-1222BS 1200R20-18PR R187 JAP9
87CCR-1223BS 1200R24 G580508
98CCR-1224BS 1200R24 G5822
109CCR-1225BS 13 R22.5 R187 JAP4
1110CCR-1226BS 1400R20 TCF R180 JAP2
1211CCR-1227BS 1400R20 TCF R180BZ JAP4
1312CCR-1211BS 1400R20VSJ TCF JAP2255
1413CCR-1212BS 165 R13C R624 IND44
1514CCR-1213BS 175/70R13 EP150 THI2
1615CCR-1214BS 185/65R15 B250 JAP2
1716CCR-1215BS 185/65R15 T001 JAP1
1817CCR-1217BS 195R14C 613 JAP4
1918CCR-1218BS 195R14C R623 THI4
2019CCR-1219BS 195R15C 613V JAP44
2120CCR-1229BS 205/70R15C R623 THI8405
2221CCR-1230BS 205R16C D840 THI26
2322CCR-1231BS 215/50 R17 EP300 THI10
2423CCR-1233BS 215/60R16 ER30 JAP88
2524CCR-1234BS 215/65R15 T005A IND44
EXAMPLE1



pic2 to select A5,A13,A21
2.PNG
View attachment 87307
to become to data have already sorted bottom
Elmarghanie Brand .xlsm
ABCDE
1ITEMCODEBRANDPURCHASESELLING
21CCR-1216BS 195/75R16C R613 JAP6
32CCR-1228BS 205/60R16 T005 THI8
43CCR-1232BS 215/55R17 T005 JAP4
54CCR-1223BS 1200R24 G580508
65CCR-1214BS 185/65R15 B250 JAP2
76CCR-1230BS 205R16C D840 THI26
87CCR-1220BS 1200 R20 18PR G580 THI20
98CCR-1221BS 1200 R20 18PR G580 JAP30471
109CCR-1222BS 1200R20-18PR R187 JAP9
1110CCR-1224BS 1200R24 G5822
1211CCR-1225BS 13 R22.5 R187 JAP4
1312CCR-1226BS 1400R20 TCF R180 JAP2
1413CCR-1227BS 1400R20 TCF R180BZ JAP4
1514CCR-1211BS 1400R20VSJ TCF JAP2255
1615CCR-1212BS 165 R13C R624 IND44
1716CCR-1213BS 175/70R13 EP150 THI2
1817CCR-1215BS 185/65R15 T001 JAP1
1918CCR-1217BS 195R14C 613 JAP4
2019CCR-1218BS 195R14C R623 THI4
2120CCR-1219BS 195R15C 613V JAP44
2221CCR-1229BS 205/70R15C R623 THI8405
2322CCR-1231BS 215/50 R17 EP300 THI10
2423CCR-1233BS 215/60R16 ER30 JAP88
EXAMPLE2


pic3:
select cells A3,A25,A19,A13 to become like this
3.PNG
View attachment 87308
Elmarghanie Brand .xlsm
ABCDE
1ITEMCODEBRANDPURCHASESELLING
21CCR-1216BS 195/75R16C R613 JAP6
32CCR-1232BS 215/55R17 T005 JAP4
43CCR-1223BS 1200R24 G580508
54CCR-1221BS 1200 R20 18PR G580 JAP30471
65CCR-1234BS 215/65R15 T005A IND44
76CCR-1228BS 205/60R16 T005 THI8
87CCR-1214BS 185/65R15 B250 JAP2
98CCR-1230BS 205R16C D840 THI26
109CCR-1220BS 1200 R20 18PR G580 THI20
1110CCR-1222BS 1200R20-18PR R187 JAP9
1211CCR-1224BS 1200R24 G5822
1312CCR-1225BS 13 R22.5 R187 JAP4
1413CCR-1226BS 1400R20 TCF R180 JAP2
1514CCR-1227BS 1400R20 TCF R180BZ JAP4
1615CCR-1211BS 1400R20VSJ TCF JAP2255
1716CCR-1212BS 165 R13C R624 IND44
1817CCR-1213BS 175/70R13 EP150 THI2
1918CCR-1215BS 185/65R15 T001 JAP1
2019CCR-1217BS 195R14C 613 JAP4
2120CCR-1218BS 195R14C R623 THI4
2221CCR-1219BS 195R15C 613V JAP44
2322CCR-1229BS 205/70R15C R623 THI8405
2423CCR-1231BS 215/50 R17 EP300 THI10
2524CCR-1233BS 215/60R16 ER30 JAP88
EXAMPLE3



so how sort these data again:
1-should arrange based on selected multiple cells in column who first, second, third ....... then arrange the whole multiple ranges

2- if I select different data then will arrange directly to data have already sorted (under data as in point1) bottom

3- if I select data have already sorted before then will arrange again and delete from old location and rise data have already existed to up
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Ok, one question:
How will the code decide if it is going to sort after two or three or four selections? Someone should say to code that "my selections are ready, I stop to select, you are ready to sort".

Do you understand what I mean?
 
Upvote 0
Someone should say to code that "my selections are ready, I stop to select, you are ready to sort".
does it mean every time when I run the code I can select multiple cells at once and re-sort again based on OP?
 
Upvote 0
does it mean every time when I run the code I can select multiple cells at once and re-sort again based on OP?
I am telling that, you are not looking for something fully automatic. You want to select cells and press a button, right?

By the way, the code will not remember the previously sorted items, once the file is closed.
 
Upvote 0
You want to select cells and press a button, right?
yes
By the way, the code will not remember the previously sorted items, once the file is closed.
so will r-sort from the first time with ignore old sorting , if it's so then it's not problem .
 
Upvote 0
One last question, do you want to consider selecting order? For example, you choose in B,A,C order instead of A'B,C. Do you want the code sort as your selection squence?
 
Upvote 0
do you want to consider selecting order? For example, you choose in B,A,C order instead of A'B,C. Do you want the code sort as your selection squence?

as you like . what's the better way you see it?
to make easy for you I think sorting selection sequence.
 
Upvote 0
It would be better for you also. You will know that your first selection will be the first, second will be second and third will be the third.
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,217
Members
453,024
Latest member
Wingit77

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