sdfjh87687
New Member
Hi coders !
I'm not maker of this, I just needed fast, effective switch of selected cells. Here it is:
Here is video I recorded how it is (non)working. This web have max 1 MB file size, so I upload is somewhere else:
bad macro tested.mp4 - 5.7 MB
In video is new Sheet, normal typed letters, just formatting is for eyes. There is no formulas, hidden cells, ...
Thank you for any help !
I'm not maker of this, I just needed fast, effective switch of selected cells. Here it is:
Code:
Sub SwapSelectedCells_fast()
If Selection.Areas.Count <> 2 Then Exit Sub
Set range1 = Selection.Areas(1)
Set range2 = Selection.Areas(2)
If range1.Rows.Count <> range2.Rows.Count Or _
range1.Columns.Count <> range2.Columns.Count Then Exit Sub
range1Address = range1.Address
range1.Cut
range2.Insert Shift:=xlShiftToRight
Range(range1Address).Delete Shift:=xlToLeft
range2Address = range2.Address
range2.Cut
Range(range1Address).Insert Shift:=xlShiftToRight
Range(range2Address).Delete Shift:=xlToLeft
End Sub
Here is video I recorded how it is (non)working. This web have max 1 MB file size, so I upload is somewhere else:
bad macro tested.mp4 - 5.7 MB
In video is new Sheet, normal typed letters, just formatting is for eyes. There is no formulas, hidden cells, ...
Thank you for any help !