![]() |
copy multiple cells
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? |
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? |
copy multiple cells
One simple, but crude, way with this exact situation.
Sub copydiag() With ActiveCell ..Copy Cells(1, Cells(1, Columns.Count).End(xlToLeft).Column + 1) ..Offset(1, 1).Copy Cells(1, Cells(1, Columns.Count).End(xlToLeft).Column + 1) ..Offset(2, 2).Copy Cells(1, Cells(1, Columns.Count).End(xlToLeft).Column + 1) End With End Sub -- Don Guillett SalesAid Software "smandula" wrote in message ups.com... 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? |
All times are GMT +1. The time now is 05:59 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com