View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gary''s Student
 
Posts: n/a
Default Is there a way to switch data between two cells?

Enter this macro:

Sub swap_it()
Dim r, r1, r2 As Range
If Selection.Count = 2 Then
i = 1
For Each r In Selection
If i = 1 Then
Set r1 = r
Else
Set r2 = r
End If
i = 2
Next
v1 = r1.Value
v2 = r2.Value
t = v1
r1.Value = v2
r2.Value = t
End If
End Sub

Then select two cells and run the macro
--
Gary''s Student


"lhassell" wrote:

I just want to be able to select two cells and have the data switch between
them without having to Cut, Copy or Paste.