Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 58
Default Swap Two Values in one Command

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Swap values in userform txtboxes CR[_2_] Excel Programming 2 November 16th 08 07:47 PM
Command Button to Swap Cells Prohock Excel Programming 3 June 13th 08 03:51 PM
swap values between two cells killdare Excel Worksheet Functions 3 November 26th 07 07:20 AM
There should be a swap function for 2 values Johnny Excel Discussion (Misc queries) 1 July 7th 06 05:56 PM
Swap range values TommySzalapski[_14_] Excel Programming 4 July 27th 05 02:09 PM


All times are GMT +1. The time now is 06:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"