#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 55
Default How can I swap cells

What is the quickest way to swap two different cells. Say I want to move the
contents of cell A5 to cell D9 and the contents of cell D9 back to A5 -
basically swapping the two. Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,805
Default How can I swap cells

Not sure what you are looking for...

Cut (or copy) and paste A5 to an empty cell, cut (or copy) and paste D9 to
A5, cut (or copy) from the cell you coped A5 and paste to D9... Clear the
cell used.

"Josh W" wrote:

What is the quickest way to swap two different cells. Say I want to move the
contents of cell A5 to cell D9 and the contents of cell D9 back to A5 -
basically swapping the two. Thanks.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 55
Default How can I swap cells

Thanks, but I knew that already. However, to swap the contents with cut and
paste is extremely tedious, especially as I have to do it quite often. I want
to know if there is any shortcut/button/macro? I just noticed some
discussions about this from a few years back. But I don't know anything about
macro's so I wouldn't know I to create the button myself. Greatly appreciate
any help..

"Sheeloo" wrote:

Not sure what you are looking for...

Cut (or copy) and paste A5 to an empty cell, cut (or copy) and paste D9 to
A5, cut (or copy) from the cell you coped A5 and paste to D9... Clear the
cell used.

"Josh W" wrote:

What is the quickest way to swap two different cells. Say I want to move the
contents of cell A5 to cell D9 and the contents of cell D9 back to A5 -
basically swapping the two. Thanks.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,805
Default How can I swap cells

Following macro will do the swap for you
Sub swap()
temp = Cells(5, 1)
Cells(5, 1) = Cells(9, 4)
Cells(9, 4) = temp
End Sub

See http://www.taltech.com/support/sw_tricks/exmacros.htm on details on how
to use a macro

"Josh W" wrote:

Thanks, but I knew that already. However, to swap the contents with cut and
paste is extremely tedious, especially as I have to do it quite often. I want
to know if there is any shortcut/button/macro? I just noticed some
discussions about this from a few years back. But I don't know anything about
macro's so I wouldn't know I to create the button myself. Greatly appreciate
any help..

"Sheeloo" wrote:

Not sure what you are looking for...

Cut (or copy) and paste A5 to an empty cell, cut (or copy) and paste D9 to
A5, cut (or copy) from the cell you coped A5 and paste to D9... Clear the
cell used.

"Josh W" wrote:

What is the quickest way to swap two different cells. Say I want to move the
contents of cell A5 to cell D9 and the contents of cell D9 back to A5 -
basically swapping the two. Thanks.

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 857
Default How can I swap cells

Hi,

This code swaps two selected cells

Sub Swap()
Y = Selection.Areas(1)
Selection.Areas(1) = Selection.Areas(2)
Selection.Areas(2) = Y
End Sub

If this helps, please click the Yes button

--
If this helps, please click the Yes button.

Cheers,
Shane Devenshire


"Josh W" wrote:

Thanks, but I knew that already. However, to swap the contents with cut and
paste is extremely tedious, especially as I have to do it quite often. I want
to know if there is any shortcut/button/macro? I just noticed some
discussions about this from a few years back. But I don't know anything about
macro's so I wouldn't know I to create the button myself. Greatly appreciate
any help..

"Sheeloo" wrote:

Not sure what you are looking for...

Cut (or copy) and paste A5 to an empty cell, cut (or copy) and paste D9 to
A5, cut (or copy) from the cell you coped A5 and paste to D9... Clear the
cell used.

"Josh W" wrote:

What is the quickest way to swap two different cells. Say I want to move the
contents of cell A5 to cell D9 and the contents of cell D9 back to A5 -
basically swapping the two. Thanks.



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 55
Default How can I swap cells

Shane, the macro works perfectly. You saved me.

"Shane Devenshire" wrote:

Hi,

This code swaps two selected cells

Sub Swap()
Y = Selection.Areas(1)
Selection.Areas(1) = Selection.Areas(2)
Selection.Areas(2) = Y
End Sub

If this helps, please click the Yes button

--
If this helps, please click the Yes button.

Cheers,
Shane Devenshire


"Josh W" wrote:

Thanks, but I knew that already. However, to swap the contents with cut and
paste is extremely tedious, especially as I have to do it quite often. I want
to know if there is any shortcut/button/macro? I just noticed some
discussions about this from a few years back. But I don't know anything about
macro's so I wouldn't know I to create the button myself. Greatly appreciate
any help..

"Sheeloo" wrote:

Not sure what you are looking for...

Cut (or copy) and paste A5 to an empty cell, cut (or copy) and paste D9 to
A5, cut (or copy) from the cell you coped A5 and paste to D9... Clear the
cell used.

"Josh W" wrote:

What is the quickest way to swap two different cells. Say I want to move the
contents of cell A5 to cell D9 and the contents of cell D9 back to A5 -
basically swapping the two. Thanks.

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 55
Default How can I swap cells

Sheelo, I used Shane's macro because that macro is a swap command for all two
cells selected, which is extremely useful. Your link to setting up macro's
was excellent. I did it the first time today. Thanks.

"Sheeloo" wrote:

Following macro will do the swap for you
Sub swap()
temp = Cells(5, 1)
Cells(5, 1) = Cells(9, 4)
Cells(9, 4) = temp
End Sub

See http://www.taltech.com/support/sw_tricks/exmacros.htm on details on how
to use a macro

"Josh W" wrote:

Thanks, but I knew that already. However, to swap the contents with cut and
paste is extremely tedious, especially as I have to do it quite often. I want
to know if there is any shortcut/button/macro? I just noticed some
discussions about this from a few years back. But I don't know anything about
macro's so I wouldn't know I to create the button myself. Greatly appreciate
any help..

"Sheeloo" wrote:

Not sure what you are looking for...

Cut (or copy) and paste A5 to an empty cell, cut (or copy) and paste D9 to
A5, cut (or copy) from the cell you coped A5 and paste to D9... Clear the
cell used.

"Josh W" wrote:

What is the quickest way to swap two different cells. Say I want to move the
contents of cell A5 to cell D9 and the contents of cell D9 back to A5 -
basically swapping the two. Thanks.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
swap values between two cells killdare Excel Worksheet Functions 3 November 26th 07 07:20 AM
How to swap contents between 2 cells in MS Excel 2003? Dhanu Excel Discussion (Misc queries) 1 October 5th 07 01:12 PM
Swap contents of two cells Sterling Excel Discussion (Misc queries) 3 October 20th 05 06:04 PM
Swap Cells William Wolfe Excel Discussion (Misc queries) 4 June 16th 05 05:18 PM
Is there a quick shortcut to swap the data in two cells? eburris Excel Discussion (Misc queries) 1 January 13th 05 11:38 PM


All times are GMT +1. The time now is 08:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"