ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Is Pivot table the way to go? (https://www.excelbanter.com/excel-programming/404421-pivot-table-way-go.html)

Net Doe

Is Pivot table the way to go?
 
I'm writing a VBA script for Excel 2003 that takes information from multiple
sheets
and mangles the pertinent information into one sheet. All the sheets have
the same format, just
different data.

One simple thing I'd like to do is to take column information, say from row
50
to row 100 on column 2 of sheet 2, and put it in row 1, column 1 to 50 of
sheet
IOW, I transpose the column data into row data. I'd like to be able to write
a
subroutine that does this for any 2 sheets, passing it the row range and
column
range for the sheets.



Nigel[_2_]

Is Pivot table the way to go?
 
No pivot table, some simple code for the subroutine....

Sub TransposeMe(wRngFrom As Range, wRngTo As Range)
wRngFrom.Copy
wRngTo.PasteSpecial Transpose:=True
Application.CutCopyMode = False
End Sub

To call it from you main code use setting the from to ranges required.....

Call TransposeMe(Sheets("Sheet2").Range("B50:B100"),
Sheets("Sheet1").Range("A1"))







--

Regards,
Nigel




"Net Doe" wrote in message
...
I'm writing a VBA script for Excel 2003 that takes information from
multiple sheets
and mangles the pertinent information into one sheet. All the sheets have
the same format, just
different data.

One simple thing I'd like to do is to take column information, say from
row 50
to row 100 on column 2 of sheet 2, and put it in row 1, column 1 to 50 of
sheet
IOW, I transpose the column data into row data. I'd like to be able to
write a
subroutine that does this for any 2 sheets, passing it the row range and
column
range for the sheets.




Net Doe

Is Pivot table the way to go?
 
Thanks; I'll play with having the calling routine geneic too so that
I can just loop through sheets, rows, cols for example.

"Nigel" wrote in message
...
No pivot table, some simple code for the subroutine....

Sub TransposeMe(wRngFrom As Range, wRngTo As Range)
wRngFrom.Copy
wRngTo.PasteSpecial Transpose:=True
Application.CutCopyMode = False
End Sub

To call it from you main code use setting the from to ranges required.....

Call TransposeMe(Sheets("Sheet2").Range("B50:B100"),
Sheets("Sheet1").Range("A1"))







--

Regards,
Nigel




"Net Doe" wrote in message
...
I'm writing a VBA script for Excel 2003 that takes information from
multiple sheets
and mangles the pertinent information into one sheet. All the sheets have
the same format, just
different data.

One simple thing I'd like to do is to take column information, say from
row 50
to row 100 on column 2 of sheet 2, and put it in row 1, column 1 to 50 of
sheet
IOW, I transpose the column data into row data. I'd like to be able to
write a
subroutine that does this for any 2 sheets, passing it the row range and
column
range for the sheets.







All times are GMT +1. The time now is 07:44 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com