re-orders columns for each sheet separately based on using inputbox

KalilMe

Active Member
Joined
Mar 5, 2021
Messages
343
Office Version
  1. 2016
Platform
  1. Windows
Hello

I look for macro by using inputbox

so should run inputbox twice first to write sheet and second to write columns as in SH1 sheet F,A,B,D,E,C then will re-order columns as I did the result should be the same columns A:F

as to SH2 first write SH2 sheet into inputbox and show next input box to write columns A,C,B,E,D and will arrange aas I did the result should be the same columns A:E

if write wrong sheet or empty columns , then the code should not work . should inform me write correct sheet or correct columns and keep inputbox is open until write right sheet and filled columns .

I will add new sheets with different columns so each sheet will arrange differently as what I want
also I posted here
re-orders columns for each sheet separately based on using inputbox
re-order (1).xlsm
ABCDEF
1ITEMSCODESQTYREFINVOICE NODATE
21BCMSK/DF54300MC ** TRM1200RE001IN-12-10002/02/2023
32BMN-234EWFGHT4500$#TY300RE002IN-12-10103/02/2023
43BMN3456GH7800/890500RE003IN-12-10204/02/2023
54BNMHG1200567HJGFR110RE004IN-12-10305/02/2023
65BVN*****FGTRXCVJKHU90RE005IN-12-10406/02/2023
76DFGTREE7689993456780RE006IN-12-10507/02/2023
87XCDF453EREWERR23460RE007IN-12-10608/02/2023
SH1


re-order (1).xlsm
ABCDE
1ITEMSCODESDATEQTYINVOICE NO
21123WEDR56GH098701/01/2023110IN-12-100
32NBTY567XDE342Q1230002/01/2023200IN-12-101
43ASW123BNGHTY678903/01/2023220IN-12-102
54CVDFHGG VF6789 RE45/70004/01/2023230IN-12-103
65D**HJUYSDFW2345KJI90005/01/2023140IN-12-104
76VBGFDRETMJHGF1234406/01/2023150IN-12-105
87ASTR10089YHHMA120007/01/2023120IN-12-106
SH2




result
re-order (1).xlsm
ABCDEF
1DATEITEMSCODESREFINVOICE NOQTY
202/02/20231BCMSK/DF54300MC ** TRM1RE001IN-12-100200
303/02/20232BMN-234EWFGHT4500$#TYRE002IN-12-101300
404/02/20233BMN3456GH7800/890RE003IN-12-102500
505/02/20234BNMHG1200567HJGFRRE004IN-12-103110
606/02/20235BVN*****FGTRXCVJKHURE005IN-12-10490
707/02/20236DFGTREE76899934567RE006IN-12-10580
808/02/20237XCDF453EREWERR234RE007IN-12-10660
SH1


re-order (1).xlsm
ABCDE
1ITEMSDATECODESINVOICE NOQTY
2101/01/2023123WEDR56GH0987IN-12-100110
3202/01/2023NBTY567XDE342Q12300IN-12-101200
4303/01/2023ASW123BNGHTY6789IN-12-102220
5404/01/2023CVDFHGG VF6789 RE45/700IN-12-103230
6505/01/2023D**HJUYSDFW2345KJI900IN-12-104140
7606/01/2023VBGFDRETMJHGF12344IN-12-105150
8707/01/2023ASTR10089YHHMA1200IN-12-106120
SH2



thanks
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Forum statistics

Threads
1,215,148
Messages
6,123,301
Members
449,095
Latest member
Chestertim

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