Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Could one of you experts answer an easy question...
Hi guys--
Simple problem for you. I've imported a dataset into Excel where each record consists of n variables, but instead of each record's variables being distributed into columns of the same row (what I want), they are all in column A on different rows. That is, rows 1 through n comprise record 1, rows n+1 through 2n comprise record 2, etc. (Everything is in the same column, and there are a total of (number of variables per record)*(number of records) rows. I'd like to take the values in rows 1 through n and put them into columns A through (n.th letter) in row 1 thus creating a normal single record. Ditto for the rest of the dataset, rows n+1 through 2n into columns A through (n.th letter) in row 2. I'll thank you guys in advance since you've always come up with a solution to my problems :) Bryan |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Could one of you experts answer an easy question...
Select your sata in column A, and run this macro. Be sure to adjust
RowsPerRec to your row count per record. Const RowsPerRec As Integer = 6 Sub a() Dim SrcRg As Range Dim Cell As Range, ColNum As Integer Dim Counter As Long Application.ScreenUpdating = False Set SrcRg = Selection Worksheets.Add For Each Cell In SrcRg Cells(Int(Counter / RowsPerRec) + 1, (Counter Mod RowsPerRec + 1)).Value = Cell.Value Counter = Counter + 1 Next End Sub -- Jim Rech Excel MVP |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Could one of you experts answer an easy question...
How are you importing your dataset?
Have you tried using Application.Transpose(rs) -- Regards, Tom Ogilvy "Bryan" wrote in message ... Hi guys-- Simple problem for you. I've imported a dataset into Excel where each record consists of n variables, but instead of each record's variables being distributed into columns of the same row (what I want), they are all in column A on different rows. That is, rows 1 through n comprise record 1, rows n+1 through 2n comprise record 2, etc. (Everything is in the same column, and there are a total of (number of variables per record)*(number of records) rows. I'd like to take the values in rows 1 through n and put them into columns A through (n.th letter) in row 1 thus creating a normal single record. Ditto for the rest of the dataset, rows n+1 through 2n into columns A through (n.th letter) in row 2. I'll thank you guys in advance since you've always come up with a solution to my problems :) Bryan |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
An easy answer I'm sure, so why am I stuck? | Excel Discussion (Misc queries) | |||
This should be easy, but can't find an answer...requesting your in | Excel Worksheet Functions | |||
Easy for the experts: Lookup,index,match.... | Excel Worksheet Functions | |||
Another Filtering Question for Excel 2007 Experts | New Users to Excel | |||
Question for the real experts! | Excel Discussion (Misc queries) |