Macro for copy data from. One sheet and arrange data in different columns

Matrikmask

New Member
Joined
Mar 8, 2018
Messages
8
Hi , can any one help me with macros for moving data from one column to other sheet with given specify range of column.
For example I have data in column sheet. A1 to A100, I want to data get copy to other sheet with range of 10 rows,i.e sheet 2,A1 to A10 in column A of other excel and A11 to A20 in column B like wise.
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
VBA Code:
Sub v()
Dim r%, c%
c = 1
For r = 1 To 100 Step 10
    Sheets("Sheet1").[A1:A100].Item(r).Resize(10).Copy Sheets("Sheet2").Cells(1, c)
    c = c + 1
Next
End Sub
 
Upvote 0
Hi footoo,

thanks for your help. Also can you please help supposed I need to make custom selection of array i. e currently with this macro we can split data in 10 and if user want to split in 20 or 13 he can filed value in one column of excel suppose G1 as 20 and then click on button it will give output in 20 splits
 
Upvote 0
Assuming you want to paste the data in column A of the active sheet (split per the number in G1) to "Sheet2" :
VBA Code:
Sub v()
Dim rng As Range, r%, c%
Set rng = Range([A1], Cells(Rows.Count, 1).End(3))
c = 1
For r = 1 To rng.Rows.Count Step [G1]
    rng(r).Resize([G1]).Copy Sheets("Sheet2").Cells(1, c)
    c = c + 1
Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,647
Messages
6,126,005
Members
449,279
Latest member
Faraz5023

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