Is it possible to swap numbers between cells?

Johncobb

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

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

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,172,022
Messages
5,878,767
Members
433,370
Latest member
mcleven

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