View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default How do I exchange cell contents between two non-adjacent cells?

Hi,

It depeends on your definition od simple. Alt +F11 to open VB editor. Right
click 'This Workbook' and insert module and paste the code below in.

Select you 2 cells then run the code

Sub SwapEm()
Dim Firstvalue(), FirstValueAddress()
a = 1
ReDim Firstvalue(2), FirstValueAddress(2)
For Each c In Selection
Firstvalue(a) = c.Value
FirstValueAddress(a) = c.Address
a = a + 1
Next c
Range(FirstValueAddress(1)).Select
ActiveCell = Firstvalue(2)
Range(FirstValueAddress(2)).Select
ActiveCell = Firstvalue(1)
End Sub

Mike

"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.