• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA Excel to replace columns with rows and rows with columns

Nadersa

New Member
how to create VBA Excel to replace columns with rows and rows with columns in every excel sheet? please write full Macro.

Thanks,
 
I, at least, will not write a program for you, but I will ask a question: Do you mean you want to (so to speak) flip all your data around so that whatever's in A1 is still in A1 but the value in E3 will end up in C5? If so, you don't need a program at all; just select all the data and use the Transpose feature to flip it around.

The way I get at Transpose is as follows:
1) Select the cells you want to submit to this treatment.
2) Select Copy. I'm sure you can do this from the ribbon, but I'm not sure how; I use the keyboard shortcut <Ctrl-Ins>, and have been using it so many years I've lost track of the more usual way.
3) Bring up the Paste Special menu. Again, I'm sure that's on the Excel ribbon somewhere but all I know how to do is <Alt-e,s>
4) In the Paste-Special menu, down near the bottom, you'll see an option "Transpose". This flips rows and columns.

This is great for a one-time operation. If you want a program to do the same thing, I'm pretty sure all the Paste-Special operations are in Excel's object model, so you'll be able to incorporate it into a VBA program. But I don't know the exact method; record yourself doing it manually and see what VBA code Excel generates for you.
 
Back
Top