#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 143
Default 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


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 143
Default 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





  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default 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

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 143
Default 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





  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default 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

  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,688
Default 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



  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default 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



  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 195
Default 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




  #10   Report Post  
Posted to microsoft.public.excel.worksheet.functions
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default 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






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
There should be a swap function for 2 values Johnny Excel Discussion (Misc queries) 1 July 7th 06 05:56 PM
Swap the X and Y axes LAUR Charts and Charting in Excel 1 May 15th 06 07:21 PM
Text Strings Swap Mzansi Excel Worksheet Functions 1 November 29th 05 11:04 AM
Swap contents of two cells Sterling Excel Discussion (Misc queries) 3 October 20th 05 06:04 PM
Swap data from one cell to another Brooks W. Excel Worksheet Functions 2 May 16th 05 03:50 PM


All times are GMT +1. The time now is 07:26 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"