View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default How do I exchange cell contents between two non-adjacent cells?

Here is some code from Gary's Student

Sub swap_um()
Dim v0 As Variant
Dim v1 As Variant
Dim s(2) As String
If Selection.Count < 2 Then Exit Sub
i = 0
For Each rr In Selection
s(i) = rr.Address
i = i + 1
Next
v0 = Range(s(0)).Value
v1 = Range(s(1)).Value
Range(s(1)).Value = v0
Range(s(0)).Value = v1
End Sub

Select any two cells...........adjacent or non-adjacentt.

Run macro.


Gord Dibben MS Excel MVP

On Fri, 12 Dec 2008 10:17:01 -0800, dave parta
wrote:

There must be a way to simply switch the contents of two Excel cells, what is
it?
answers to will be greatly appreciated.