ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   swap (https://www.excelbanter.com/excel-worksheet-functions/102399-swap.html)

Gary

swap
 
I want to swap values of two cells. can anyone help me on that? Eg. Cell A1
contains the value 20 & cell A2 contains the value 100. I want 100 on A1 &
20 on A2.

Thanks
Gary



JMB

swap
 
Select cell A1. Type in 100. Hit Enter.
Same process for cell A2.


"Gary" wrote:

I want to swap values of two cells. can anyone help me on that? Eg. Cell A1
contains the value 20 & cell A2 contains the value 100. I want 100 on A1 &
20 on A2.

Thanks
Gary




Gary

swap
 
Nice joke JMB, I have 5000 cells to swap.

any idea?

"JMB" wrote in message
...
Select cell A1. Type in 100. Hit Enter.
Same process for cell A2.


"Gary" wrote:

I want to swap values of two cells. can anyone help me on that? Eg. Cell
A1
contains the value 20 & cell A2 contains the value 100. I want 100 on A1
&
20 on A2.

Thanks
Gary






Desert Piranha

swap
 

Gary Wrote:
I want to swap values of two cells. can anyone help me on that? Eg. Cell
A1
contains the value 20 & cell A2 contains the value 100. I want 100 on
A1 &
20 on A2.

Thanks
GaryHi Gary,


Something on the order of this work?
Of course change tye ranges.


Code:
--------------------
Sub SwapCells()
Dim x As Integer
x = Range("a5").Value
Range("a5").Value = Range("a6").Value
Range("a6").Value = x
End Sub
--------------------


--
Desert Piranha


------------------------------------------------------------------------
Desert Piranha's Profile: http://www.excelforum.com/member.php...o&userid=28934
View this thread: http://www.excelforum.com/showthread...hreadid=566905


Gary

swap
 
Thanks a ton Desert. Its working fine. How do i add more ranges..can i just
write x=range("a5:a2000") ?

"Desert Piranha"
<Desert.Piranha.2buhdn_1154408103.6074@excelforu m-nospam.com wrote in
message news:Desert.Piranha.2buhdn_1154408103.6074@excelfo rum-nospam.com...

Gary Wrote:
I want to swap values of two cells. can anyone help me on that? Eg. Cell
A1
contains the value 20 & cell A2 contains the value 100. I want 100 on
A1 &
20 on A2.

Thanks
GaryHi Gary,


Something on the order of this work?
Of course change tye ranges.


Code:
--------------------
Sub SwapCells()
Dim x As Integer
x = Range("a5").Value
Range("a5").Value = Range("a6").Value
Range("a6").Value = x
End Sub
--------------------


--
Desert Piranha


------------------------------------------------------------------------
Desert Piranha's Profile:
http://www.excelforum.com/member.php...o&userid=28934
View this thread: http://www.excelforum.com/showthread...hreadid=566905




Desert Piranha

swap
 

Gary Wrote:
Thanks a ton Desert. Its working fine. How do i add more ranges..can i
just
write x=range("a5:a2000") ?Hi Gary,


Are you looking for columns?

Like swap Column A and Column B.

Sub SwapCells()
Dim x As Integer ' Use this line for numbers or
' Dim x ' Use this line for text and numbers
x = Range("a5:a2000").Value
Range("a5:a2000").Value = Range("b5:b2000").Value
Range("b5:b2000").Value = x
End Sub


--
Desert Piranha


------------------------------------------------------------------------
Desert Piranha's Profile: http://www.excelforum.com/member.php...o&userid=28934
View this thread: http://www.excelforum.com/showthread...hreadid=566905


Biff

swap
 
Hi!

Try this:

=OFFSET(A1,1*IF(MOD(ROWS($1:1),2),1,-1),,)

Copy down as needed.

After you get everything flipped you can convert the formulas to constants
by:

Selecting the range of formulas
Goto EditCopy
Then, EditPaste SpecialValuesOK

Then, you can delete the original data if desired.

Biff

"Gary" wrote in message
...
I want to swap values of two cells. can anyone help me on that? Eg. Cell A1
contains the value 20 & cell A2 contains the value 100. I want 100 on A1 &
20 on A2.

Thanks
Gary




Eli Shichrur

swap
 
USE "Ctrl" + "x" on The Source and "Ctrl" + "+" on the desteney

"Gary" wrote:

I want to swap values of two cells. can anyone help me on that? Eg. Cell A1
contains the value 20 & cell A2 contains the value 100. I want 100 on A1 &
20 on A2.

Thanks
Gary




shail

swap
 
Hi Eli,

Thanks, it is great.

Shail


Eli Shichrur wrote:
USE "Ctrl" + "x" on The Source and "Ctrl" + "+" on the desteney

"Gary" wrote:

I want to swap values of two cells. can anyone help me on that? Eg. Cell A1
contains the value 20 & cell A2 contains the value 100. I want 100 on A1 &
20 on A2.

Thanks
Gary





JMB

swap
 
And exactly where in your original post did you state that you had 5000
cells, pray tell.


"Gary" wrote:

Nice joke JMB, I have 5000 cells to swap.

any idea?

"JMB" wrote in message
...
Select cell A1. Type in 100. Hit Enter.
Same process for cell A2.


"Gary" wrote:

I want to swap values of two cells. can anyone help me on that? Eg. Cell
A1
contains the value 20 & cell A2 contains the value 100. I want 100 on A1
&
20 on A2.

Thanks
Gary








All times are GMT +1. The time now is 02:48 AM.

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