Is it possible to swap numbers between cells?

Johncobb

New Member
Joined
Sep 7, 2006
Messages
28
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

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type

mtb'r

New Member
Joined
Sep 8, 2006
Messages
42
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.
 

Forum statistics

Threads
1,136,655
Messages
5,677,015
Members
419,668
Latest member
DharmaK

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
Top