ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Transpose macro (https://www.excelbanter.com/excel-programming/394080-transpose-macro.html)

bamf

Transpose macro
 
Hi, I have a workbook that has data arranged into columns (each column refers
to one client) and are linked across a number of worksheets.

I need to write a macro that will copy the data from multiple columns to one
row. eg:
a1 b1 c1
a2 b2 c2
a3 b3 c3

into
a1 a2 a3
b1 b2 b3
c1 c2 c3

Any guidance would be great!
Thanks
Jo

CoRrRan

Transpose macro
 
bamf wrote:
Hi, I have a workbook that has data arranged into columns (each column refers
to one client) and are linked across a number of worksheets.

I need to write a macro that will copy the data from multiple columns to one
row. eg:
a1 b1 c1
a2 b2 c2
a3 b3 c3

into
a1 a2 a3
b1 b2 b3
c1 c2 c3

Any guidance would be great!
Thanks
Jo


Just use the "Transpose"-function of Excel in your code:

*********************
Dim rng As Range

Set rng = Range("A1:C3")

Range("A4:C6") = Application.WorksheetFunction.Transpose(rng)
*********************

CoRrRan


All times are GMT +1. The time now is 03:00 PM.

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