Grab 5 rows of 25 numbers and paste them as one line of 125

Posted on 2014-01-27
Last Modified: 2014-02-01

I have 5 rows, each contains 25 numbers (125) numbers in total.  Which is the easiest and fastest way to grab this 5 x 25 numbers and paste them elsewhere as one row of 125 numbers?

Thank you
Question by:DemonForce

Expert Comment

ID: 39813321
You could save the file as a .csv file, then open it with Notepad... it would give you all 5 of your rows separated by a ','.  Just delete the 4 commas in the file, save it, then open it back up w/ Excel.

Expert Comment

ID: 39813324
There are also numerous ways you could automate this process with PowerShell... not sure how comfortable you are with scripting, but I could create a sample script that would do this if you're comfortable running scripts.  What operating system are you using?

Author Comment

ID: 39813350
Hi, needs to be in Excel VBA so its automated thanx
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

LVL 47

Accepted Solution

Martin Liss earned 500 total points
ID: 39813370
Here's a macro you can use. It assumes the data is in rows 1 to 5 and it puts the data in row 6.

Sub CombineRows()
Dim intSel As Integer
Dim intPaste As Integer

Application.ScreenUpdating = False

intPaste = 1
' Assumes the data is in rows 1 to 5
For intSel = 1 To 5
    Range("A" & intSel & ":" & "Y" & intSel).Select
    ' Puts the result in row 6
    Cells(6, intPaste).Select
    intPaste = intPaste + 25

Application.CutCopyMode = False
Application.ScreenUpdating = True

Open in new window


Expert Comment

ID: 39813391
ahh, sorry, misunderstood... not really an Excel expert, so apologies for wasting time here.... that being said, it looks like you can just concatenate your rows with '&':


That's making the assumption that when you say you have 25 numbers per row, that they are 25 numbers in a single column.... if they are 5 rows x 25 columns, then this would take longer to type in for 125 cells.


Expert Comment

ID: 39813394
ahh, looks like someone posted who is way more familiar with this than I am... signing out, looks like you have a better person to ask than me:)
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 39813992
You can also try this one-liner. C10 is where the table starts. A7 is where the results starts (this should remain in column A. If you want to change it some modification is required).

Sub tab2row()
Range("A7").Resize(, 25).Formula = "=index(" & Range("C10").Resize(5, 5).Address & ",(COLUMN()-1)/5+1,MOD(COLUMN()-1,5)+1)"
End Sub

Open in new window

LVL 47

Expert Comment

by:Martin Liss
ID: 39826476
I'm glad I was able to help.

In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2013

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question