Transpose macro

B

bamf

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
 
C

CoRrRan

bamf said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top