View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Loop and transpose sets of data

Sub copyandtranspose()
Dim lastrow as Long, lastCol as Long
Dim rng as Range, i as Long
With worksheets("Sheet1")
lastrow = .cells(rows.count,1).End(xlup).Row
for i = 1 to lastrow Step 11
set rng = Worksheets("Sheet2") _
.Cells(rows.count,1).End(xlup)(2)
lastcol = .cells(i,256).End(xltoLeft).Column
.cells(i,1).Resize(11,lastcol).copy
rng.PasteSpecial xlValue, Transpose:=True
Next
End With
End Sub

--
Regards,
Tom Ogilvy



"Sach" wrote in message
...
Hello everyone,
Im new to the list and havent done any programming in a while, but am
working on a spreadsheet for a customer and need help with something i

think
is relatively simple (I just can't get it)

I have data in a set of 11 rows, which could be of varying quantites.. but
always 11 rows...

row1-11 ... text of various sorts
row12-22... text in same pattern as above..

what i need is a loop that will select the first 11 rows, and transpose

and
paste into another sheet, and then select the next 11 rows and do the

same,
and continue on until all data has been picked up.

Thanks in advance to anyone who can help.
Let me know if it needs clarification
Rgds
Sach