Thread
:
Is there an easy way to swap the contents of two cells in Excel?
View Single Post
#
2
Dodo
Posts: n/a
?B?Ti5CLiBZb25k?= <N.B.
wrote in
:
I think the subject says it all...
You could add a button to the sheet with following code behind it:
Private Sub CommandButton1_Click()
cel1 = InputBox("First cell?")
cel2 = InputBox("Second cell?")
c1 = Range(cel1).Value
c2 = Range(cel2).Value
Range(cel1).Value = c2
Range(cel2).Value = c1
End Sub
You will be asked for the 2 cell addresses and the contents will be
swapped.
Reply With Quote