ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Swap data from one cell to another (https://www.excelbanter.com/excel-worksheet-functions/26320-swap-data-one-cell-another.html)

Brooks W.

Swap data from one cell to another
 
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.

--
Brooks W.

Vasant Nanavati

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.

--

Vasant



"Brooks W." wrote in message
...
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.

--
Brooks W.




Duke Carey

What you want can be accomplished if you EditCut the text in F12, select
E12, and InsertCut cells

"Brooks W." wrote:

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.

--
Brooks W.



All times are GMT +1. The time now is 09:01 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com