View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Sheeloo[_3_] Sheeloo[_3_] is offline
external usenet poster
 
Posts: 1,805
Default Arranging single-row records across multiple rows

It is not my day today...

It will work for 100 rows unless your replace 100 by LastRow.

You can delete the MsgBox row
--
If you find this post helpful pl. choose "Yes"...


"Sheeloo" wrote:

Thanks for your feedback...

DO post back if you comeup with an elegant solution.

You may try this macro
This will work upto 65K/4 rows of data
'-------------------------------
Sub copyname()
Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim LastRow

LastRow = Sheets("Sheet2").Cells(65536, "B").End(xlUp).Row
MsgBox LastRow
k = 2
For i = 2 To 100
For j = 2 To 5
Sheets("sheet1").Cells(k, 2).Value = Sheets("Sheet2").Cells(i, j).Value
k = k + 1
Next j
Next i
End Sub
'-------------------------------
--
If you find this post helpful pl. choose "Yes"...


"Greg Spencer" wrote:

My toddler's playgroup needs to arrange worksheet data in a bizarre fashion
(one record per every 4 lines) from a conventional worksheet table with one
record per row.

Specifically... we need to take firstname, middle names, surname and
preferred name from consecutive columns of our main worksheet (e.g.
B2,C2,D2,E2)... and produce a sheet formatted so that the first column reads
as follows:

firstname (from B2)
middlename (from C2)
surname (from D2)
preferred name (from E2)
firstname (from B3)
middlename (from C3)
surname (from D3)
preferred name (from E3)

Repeat for up to 50 records...

Sadly, that's just the start of it: I've then got to get an address in one
of the adjacent columns (again over 4 rows per record) and calculated data in
other columns.

Pivot table doesn't really seem to help... and whilst I'm happy to work my
way through help files... I don't even know where to start looking!

Greg.