ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   column to row macro (https://www.excelbanter.com/excel-programming/434379-column-row-macro.html)

Steve

column to row macro
 
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.



Gary''s Student

column to row macro
 
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

--
Gary''s Student - gsnu200906


"Steve" wrote:

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.



Steve

column to row macro
 
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.

"Gary''s Student" wrote:

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

--
Gary''s Student - gsnu200906


"Steve" wrote:

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.



Gary''s Student

column to row macro
 
Thanks for the feeedback.
--
Gary''s Student - gsnu200906


"Steve" wrote:

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.

"Gary''s Student" wrote:

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

--
Gary''s Student - gsnu200906


"Steve" wrote:

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.



mark_the_yeti[_2_]

column to row macro
 
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.

"Steve" wrote:

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.

"Gary''s Student" wrote:

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

--
Gary''s Student - gsnu200906


"Steve" wrote:

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.




All times are GMT +1. The time now is 09:55 AM.

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