Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
lhassell
 
Posts: n/a
Default Is there a way to switch data between two cells?

I just want to be able to select two cells and have the data switch between
them without having to Cut, Copy or Paste.
  #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.

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
Setting hover data labels to cells other than source data Darren Charts and Charting in Excel 1 January 24th 06 10:20 AM
Setting hover data labels to cells other than source data Darren Excel Discussion (Misc queries) 0 January 24th 06 08:31 AM
From several workbooks onto one excel worksheet steve Excel Discussion (Misc queries) 6 December 1st 05 08:03 AM
Help PLEASE! Not sure what answer is: Match? Index? Other? baz Excel Worksheet Functions 7 September 3rd 05 03:47 PM
How do I copy data (word) into respective cells when the data bei. awg9tech New Users to Excel 1 January 12th 05 11:26 AM


All times are GMT +1. The time now is 03:41 AM.

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

About Us

"It's about Microsoft Excel"