Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How to swap Two Values in one Command.
xxx=value1 value1=value2 value2=xxx |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I think you'll need that intermediate variable.
sort wrote: How to swap Two Values in one Command. xxx=value1 value1=value2 value2=xxx -- Dave Peterson |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If Value1 and Value2 are numeric values, then you can swap them without the
need for an intermediate variable... Value1 = Value1 + Value2 Value2 = Value1 - Value2 Value1 = Value1 - Value2 -- Rick (MVP - Excel) "Dave Peterson" wrote in message ... I think you'll need that intermediate variable. sort wrote: How to swap Two Values in one Command. xxx=value1 value1=value2 value2=xxx -- Dave Peterson |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Interesting way of doing the swap and had a look at it, but using an
intermediate variable turns out to be twice as fast. RBS "Rick Rothstein" wrote in message ... If Value1 and Value2 are numeric values, then you can swap them without the need for an intermediate variable... Value1 = Value1 + Value2 Value2 = Value1 - Value2 Value1 = Value1 - Value2 -- Rick (MVP - Excel) "Dave Peterson" wrote in message ... I think you'll need that intermediate variable. sort wrote: How to swap Two Values in one Command. xxx=value1 value1=value2 value2=xxx -- Dave Peterson |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello Mr. Rothstein,
Very nice solution. I usually enjoy your replies and wonder which forum you are going to "migrate" to? I am a bit disappointed in MS's phony instructions. Best Regards, Gabor Sebo ----- Original Message ----- From: "Rick Rothstein" Newsgroups: microsoft.public.excel.programming Sent: Sunday, May 30, 2010 12:21 AM Subject: Swap Two Values in one Command If Value1 and Value2 are numeric values, then you can swap them without the need for an intermediate variable... Value1 = Value1 + Value2 Value2 = Value1 - Value2 Value1 = Value1 - Value2 -- Rick (MVP - Excel) "Dave Peterson" wrote in message ... I think you'll need that intermediate variable. sort wrote: How to swap Two Values in one Command. xxx=value1 value1=value2 value2=xxx -- Dave Peterson "Rick Rothstein" wrote in message ... If Value1 and Value2 are numeric values, then you can swap them without the need for an intermediate variable... Value1 = Value1 + Value2 Value2 = Value1 - Value2 Value1 = Value1 - Value2 -- Rick (MVP - Excel) "Dave Peterson" wrote in message ... I think you'll need that intermediate variable. sort wrote: How to swap Two Values in one Command. xxx=value1 value1=value2 value2=xxx -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Swap values in userform txtboxes | Excel Programming | |||
Command Button to Swap Cells | Excel Programming | |||
swap values between two cells | Excel Worksheet Functions | |||
There should be a swap function for 2 values | Excel Discussion (Misc queries) | |||
Swap range values | Excel Programming |