ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro needed (https://www.excelbanter.com/excel-programming/360935-macro-needed.html)

keithdixon

Macro needed
 

I am wanting a macro to move cut cells from a column and paste to
rows:-

Currently i have 15 cells in a column, and am needing the 1st to stay
where it is, cell 2 to move to the right of cell 1, cell 3 to move 2 to
the right of cell 1, cell 4 to move 3 to the right of cell 1 etc

Any clues?

I have tried recording a macro but it always paste's upon my 1st row.

Thanks in advance

regards


keith dixon


--
keithdixon
------------------------------------------------------------------------
keithdixon's Profile: http://www.excelforum.com/member.php...o&userid=34264
View this thread: http://www.excelforum.com/showthread...hreadid=540214


Ardus Petus

Macro needed
 
Try this (not fully tested)

HTH
--
AP

'----------------
Sub transpose()
Dim rcell As Range
Dim rPivot As Range
' Validate selection
If Selection.Columns.Count < 1 _
Or Selection.Areas.Count < 1 Then
MsgBox "Select one column only"
Exit Sub
End If
' Initialize pivot cell
Set rPivot = Selection.Cells(1)
' Transpose
For Each rcell In Selection
rPivot.Offset(0, rcell.Row - rPivot.Row) = rcell.Value
' Clear old value
If rcell.Row < rPivot.Row Then rcell.ClearContents
Next rcell
End Sub
'------------------------

"keithdixon" a
écrit dans le message de news:
...

I am wanting a macro to move cut cells from a column and paste to
rows:-

Currently i have 15 cells in a column, and am needing the 1st to stay
where it is, cell 2 to move to the right of cell 1, cell 3 to move 2 to
the right of cell 1, cell 4 to move 3 to the right of cell 1 etc

Any clues?

I have tried recording a macro but it always paste's upon my 1st row.

Thanks in advance

regards


keith dixon


--
keithdixon
------------------------------------------------------------------------
keithdixon's Profile:
http://www.excelforum.com/member.php...o&userid=34264
View this thread: http://www.excelforum.com/showthread...hreadid=540214





All times are GMT +1. The time now is 08:51 PM.

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