How to switch data between cells?
Is there a quick way to switch data between cells? I.E. Imagine a ranking
system where the data is ever changing. One day I may want to switch the data from A2 to A5 and A5 to A2. The next may be A7 switching to A1, etc., etc. Just curious if there is a quick way to do this. I am running excel 2003. Any and all help is greatly appreciated. |
How to switch data between cells?
One way (using a macro - attach it to a button, keystroke or menu item):
Public Sub SwapCells() Dim vTemp As Variant With Selection If .Count < 2 Then MsgBox "2 cells only." Else If .Areas.Count = 2 Then vTemp = .Areas(1).Cells.Value .Areas(1).Cells.Value = .Areas(2).Cells.Value .Areas(2).Cells.Value = vTemp Else vTemp = .Cells(1).Value .Cells(1).Value = .Cells(2).Value .Cells(2).Value = vTemp End If End If End With End Sub In article , Ruger wrote: Is there a quick way to switch data between cells? I.E. Imagine a ranking system where the data is ever changing. One day I may want to switch the data from A2 to A5 and A5 to A2. The next may be A7 switching to A1, etc., etc. Just curious if there is a quick way to do this. I am running excel 2003. Any and all help is greatly appreciated. |
All times are GMT +1. The time now is 08:45 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com