Data arrangement macro

makinmomb

Active Member
Joined
Dec 23, 2013
Messages
401
I want to re arrange my data as follows , if i do manually it will take long
, cell reference A meaning on sheet 2

D3TOA1
E3TOA2
J3TOA3
O3TOA4
N3TOA5
F3TOA6
G3TOA7
I3TOA8
H3TOA9
B3TOA10
K3TOA11
M3TOA12
C3TOA13
W3TOA14
U3TOA15
V3TOA16
S3TOA17
T3TOA18
X3TOA19
AA3TOA20
Y3TOA21

<colgroup><col width="64" span="3" style="width:48pt"> </colgroup><tbody>
</tbody>
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Here's a way without VBA.

Enter the Sheet1 cell refs in column B of Sheet2
Enter in A1 of Sheet2 and fill down : =INDIRECT("Sheet1!" & B1)
Convert Sheet2 column A to value
Delete Sheet2 column B
 
Upvote 0
I have to data sheets of like 100 rows thus need this macro badly before this work eats away my day doing it the painful manner
 
Upvote 0
Assuming your data starts on Row 3 (as your posted example suggests), and assuming you want the output to go to Sheet2, give this macro a try...
Code:
[table="width: 500"]
[tr]
	[td]Sub ReorderTransposeColumns()
  Dim LastRow As Long, Rng As Range
  LastRow = Cells.Find("*", , xlValues, , xlRows, xlPrevious, , , False).Row
  Sheets("Sheet2").Range("A1").Resize(21, LastRow - 2) = Application.Transpose(Application.Index(Cells, Evaluate("ROW(3:" & LastRow & ")"), Split("4 5 10 15 14 6 7 9 8 2 11 13 3 23 21 22 19 20 24 27 25")))
End Sub[/td]
[/tr]
[/table]
 
Last edited:
Upvote 0
Rick thank you , i dont need even the extra sheets , i hope the macro will work too for say 10 trucks , thus were data for 3 trucks
 
Upvote 0
Rick can you please edit the macro to correct this output , at where it picks 3195000 there needs to be
1500 prior that being the quantity of the value , like it did 500 followed by 1185000

911000
0
0
0
0
3195000
500
1185000

<colgroup><col></colgroup><tbody>
</tbody>
 
Upvote 0
I must say its rick who introduced me to macros , i recall he even gave
me the the keys to get to the module and run a macro , since then i have
saved tons of hours and courtesy thx Rick to have changed my style of
how i use Excel , i am sure to have saved tons of hours and rocking to
better jobs due to the speed macros give
 
Upvote 0
Oh yeah it extracts records endlessly , i tried to append data at below the file and does the needful , thank you rick again for taking care of that too
 
Upvote 0

Forum statistics

Threads
1,214,585
Messages
6,120,390
Members
448,957
Latest member
Hat4Life

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