Swap data from one cell to another

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way to swap data from one cell to another?

What I need is a way to swap the data from say E12 to F12 and also swap F12
to E12 at the same time.

Don't know if this is possible, but any help wold be appreciated.
 
You can do it with a macro:

Sub SwapData(rng1 As Range, rng2 As Range)
Dim sTemp As Variant
sTemp = rng1
rng1 = rng2
rng2 = sTemp
End Sub

Put this in a standard module. Then:

SwapData Range("E12"), Range("F12")

typed and entered into the Immediate Window will swap the data.
 
What you want can be accomplished if you Edit>Cut the text in F12, select
E12, and Insert>Cut cells
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top