View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default copy multiple cells

If it is just three cells, you could put their values in a defined range

Sub Pickup()
Dim i As Long
Dim v(1 To 3) As Variant
For i = 1 To 3
v(i) = Cells(i, i)
Cells(i, i).ClearContents
Next
ThisWorkbook.Names.Add Name:="MyName", _
RefersTo:=v

End Sub
Sub Putback()
Dim i As Long
Dim v As Variant
v = Evaluate("MyName")
For i = 1 To 3
Cells(i, i) = v(i)
Next
End Sub

If they contain formulas, then it would require a modification.

--
Regards,
Tom Ogilvy


"smandula" wrote:

I would like to copy multiple cells that are on a diagonal such as

A B C
1 22
2 17
3 34

either to another place on the spreadsheet or hold these value,
but remove them from A1, B2, C3

If holding is possible to put back in original positions later.

Any thoughts?