Solved

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

Posted on 2014-01-27
8
114 Views
Last Modified: 2014-02-01
Hi,

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
0
Comment
Question by:DemonForce
8 Comments
 
LVL 6

Expert Comment

by:Spyder2010
Comment Utility
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.
0
 
LVL 6

Expert Comment

by:Spyder2010
Comment Utility
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?
0
 

Author Comment

by:DemonForce
Comment Utility
Hi, needs to be in Excel VBA so its automated thanx
0
 
LVL 45

Accepted Solution

by:
Martin Liss earned 500 total points
Comment Utility
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
    Selection.Copy
    ' Puts the result in row 6
    Cells(6, intPaste).Select
    ActiveSheet.Paste
    intPaste = intPaste + 25
Next

Application.CutCopyMode = False
Application.ScreenUpdating = True

Open in new window

0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 6

Expert Comment

by:Spyder2010
Comment Utility
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 '&':

=A1&B1&C1&D1&E1

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.

reference:
http://www.techonthenet.com/excel/formulas/concat2.php
0
 
LVL 6

Expert Comment

by:Spyder2010
Comment Utility
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:)
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
Comment Utility
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

0
 
LVL 45

Expert Comment

by:Martin Liss
Comment Utility
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
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Sparklines have been introduced with Excel 2010 and are a useful tool for creating small in-cell charts, used for example in dashboards. Excel 2010 offers three different types of Sparklines: Line, Column and Win/Loss. What it does not offer is a…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …

762 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now