Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
How do I exchange cell contents between two non-adjacent cells?
There must be a way to simply switch the contents of two Excel cells, what is
it? answers to will be greatly appreciated. |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
How do I exchange cell contents between two non-adjacent cells?
Not natively.
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. |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
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. |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
How do I exchange cell contents between two non-adjacent cells?
Here is some code from Gary's Student
Sub swap_um() Dim v0 As Variant Dim v1 As Variant Dim s(2) As String If Selection.Count < 2 Then Exit Sub i = 0 For Each rr In Selection s(i) = rr.Address i = i + 1 Next v0 = Range(s(0)).Value v1 = Range(s(1)).Value Range(s(1)).Value = v0 Range(s(0)).Value = v1 End Sub Select any two cells...........adjacent or non-adjacentt. Run macro. Gord Dibben MS Excel MVP On Fri, 12 Dec 2008 10:17:01 -0800, 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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
sum cells based on contents of adjacent cell (validated list)? | Excel Worksheet Functions | |||
Clear Contents of Adjacent Cell on Conditional Basis | Excel Discussion (Misc queries) | |||
Displaying contents of adjacent cells. | Excel Discussion (Misc queries) | |||
Contents of adjacent cell from a function | Excel Worksheet Functions | |||
exchange contents of cells | New Users to Excel |