column to row macro

S

Steve

morning all.
I have a text document that I've imported to Excel. It's on one row, across
approximately 1000 columns. I.e., out to AXD.

I need to move the cell contents for each into a single column-- A.

I'm thinking something along the line of-

dim i as integer

while activecell.value<>""

select.offset(0,i).cut

select.offset(1,-i).paste

loop

Your helps are appreciated.
Thank you.
 
G

Gary''s Student

No loop is needed:

Sub Steve()
Dim n As Long
n = Cells(1, Columns.Count).End(xlToLeft).Column
Range(Cells(1, 1), Cells(1, n)).Copy
Range("A2").PasteSpecial Paste:=xlPasteAll, Transpose:=True
End Sub
 
S

Steve

k-ching!!!!! Wow.... all in one action too.

Thank you!!!!!!!!!
I'll have to read more on transpose.... that's a good one to know.
Have a great day.
 
M

mark_the_yeti

You don't even need to write code if you're only doing it once or twice -
just select the cells, right-click-cut, right-click-paste special, select
transpose.
 

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