Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Loop and transpose sets of data

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Loop and transpose sets of data

Thanks very much Tom, that worked a treat. Now I need to do some LEFT/RIGHT
trimming to the data to move some of the rubbish... could someone please
assist with below?

Data is currently transposed to look like this
columns
A = 1. joe bloggs ConstructionPhone: (06) 111-1111
b = Fax: (06) 222-2222
c =999 Young Street
d= New Plum
e= PO Box 880
f = New Plum, 4615


What i need it to look like is this:
columns
a = joe bloggs Construction //remove the first 3
characters (ie
number
"1.")
b= (06) 111-1111 //remove the word Phone:
c=(06) 222-2222 //remove the word fax
d =999 Young Street
e= PO Box 880
f = New Plum //split the postcode
g =4615

I currently have it working in a rather adhoc manner into a few hidden
sheets using LEFT/RIGHT etc, but was hoping there was a way to do this in the
macro... to tidy it up...
thanks in advance
Sach




"Tom Ogilvy" wrote:

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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel graph 3 sets of data. 2 sets as lines 1 as column? AndyN Charts and Charting in Excel 2 July 11th 08 01:18 PM
show 3 sets of data per data point in a scatter plot Marie Charts and Charting in Excel 6 May 19th 08 09:38 PM
3 Different Data Sets Otillio Charts and Charting in Excel 0 April 3rd 08 05:27 AM
need a formula to transpose sets of data from Sheet1 to Sheet2 cj2k2k Excel Discussion (Misc queries) 7 August 1st 07 11:54 AM
how do i link up 2 sets of data into 1 set of data in excel Mike Excel Worksheet Functions 2 October 21st 06 01:52 AM


All times are GMT +1. The time now is 02:59 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"