ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   transpose data between columns, rows or cells (https://www.excelbanter.com/new-users-excel/102277-transpose-data-between-columns-rows-cells.html)

jonnel

transpose data between columns, rows or cells
 

Hi,

How can I switch data between cells, rows or columns in one step? For
instance, if I want to switch the contents of cells A1 and B1, how do I
do that without having to retype everyting, and without having to use a
third column (that's what I do now: first I copy B1 to C1, then A1 to
B1, then C1 to A1, then delete C1 - this method is obviously very
tedious...).

Tnx,
John


--
jonnel
------------------------------------------------------------------------
jonnel's Profile: http://www.excelforum.com/member.php...o&userid=36946
View this thread: http://www.excelforum.com/showthread...hreadid=566598


Bernard Liengme

transpose data between columns, rows or cells
 
Insert a new column; fill with integers 1,2,3 and do a sort on this and the
column of interest.
Delete the helper column when done.

OR use this subroutine with the first of the two cells as the activecell

Sub transpose()
Set cell1 = ActiveCell
Set cell2 = ActiveCell.Offset(1, 0)
temp = cell1
ActiveCell = cell2
ActiveCell.Offset(1, 0) = temp
End Sub

Change the (1,0) to (0,1) to transpose horizontally
--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email

"jonnel" wrote in
message ...

Hi,

How can I switch data between cells, rows or columns in one step? For
instance, if I want to switch the contents of cells A1 and B1, how do I
do that without having to retype everyting, and without having to use a
third column (that's what I do now: first I copy B1 to C1, then A1 to
B1, then C1 to A1, then delete C1 - this method is obviously very
tedious...).

Tnx,
John


--
jonnel
------------------------------------------------------------------------
jonnel's Profile:
http://www.excelforum.com/member.php...o&userid=36946
View this thread: http://www.excelforum.com/showthread...hreadid=566598





All times are GMT +1. The time now is 03:07 PM.

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