Copy and paste transposed - help please

Jimbeau13

New Member
Joined
Jan 23, 2019
Messages
2
I am relatively new to this so please have patience.

I have an excel spreadsheet with about 150,000 values in column A (so A1 to A150000). I need to copy 10 of them and then paste them transposed into the 10 columns to the right (B through K).

Currently I am selecting the 10 (A1 to A10), copying them, then highlighting the next 10 cells (B1 to B10) and pasting transposed. This fills all of the next 10 columns with data.

Problem is this is very tedious and I have a long way to go. Is there something I can do to automate this process?

Thank you so much in advance.
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Personally, I would load your data into PowerQuery (Get&Transform) and then transpose the data set and load it to the required location.
 
Upvote 0
Hi & welcome to MrExcel.
How about
Code:
Sub Jimbeau13()
   Dim Ary As Variant, Nary As Variant
   Dim r As Long, nr As Long, nc As Long
   
   Ary = Range("A1", Range("A" & Rows.Count).End(xlUp)).Value2
   ReDim Nary(1 To (UBound(Ary) / 10) + 1, 1 To 10)
   nr = 1
   For r = 1 To UBound(Ary)
      nc = nc + 1
      Nary(nr, nc) = Ary(r, 1)
      If nc = 10 Then nc = 0: nr = nr + 1
   Next r
   Range("B1").Resize(nr, 10).Value2 = Nary
End Sub
 
Upvote 0
Thank you so much for the responses. Unfortunately I do not know where to put Fluffs code (I am new at this).

I am using Excel 2016. I will do some research and try to figure out a solution in PowerQuery. That is also a new tool to me.

Either way I really appreciate your time in this.
 
Upvote 0
Here is how to use Fluff's code



Standard Module
How to install your new code
Copy the Excel VBA code
Select the workbook in which you want to store the Excel VBA code
Press Alt+F11 to open the Visual Basic Editor
Choose Insert > Module
Edit > Paste the macro into the module that appeared
Close the VBEditor
Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)


To run the Excel VBA code:
Press Alt-F8 to open the macro list
Select a macro in the list
Click the Run button
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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