Is it possible to swap numbers between cells?

Johncobb

New Member
Joined
Sep 7, 2006
Messages
43
Office Version
  1. 365
Platform
  1. Windows
I have a worksheet, A1:CB200.
In my worksheet I would like to swap numbers between cells, is it possible to do it automatically? Can Excel do it in one click?
For example in my work sheet in row 3 in column B, I have a number 79 with a reference: =ABS(CA2) and i would like to swap this number/cell with number 51 that is in row 3, column AO and has a reference =ABS(AY2).
The reference here is irrelevant because I want to swap many numbers between cells.
I just want to know if it is possible to do it in pairs by selecting two numbers at a time and swaping them without doing it manually one by one.
Thanks in advance for your help.
Regards,
John
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Create a VBA userform to collect the addresses of the cells to be switched. Then, use a temporary variable to do the exchange.

If a1 and a2 are the addresses, the exchange code could be something like:
temp = range(a1)
range(a1) = range(a2)
range(a2) = temp

You could also do this without the userform. Just use 2 different inputboxes to collect the address to be exchanged.
 
Upvote 0

Forum statistics

Threads
1,215,032
Messages
6,122,772
Members
449,095
Latest member
m_smith_solihull

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top