Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how to copy multiple cells into one cell | Excel Discussion (Misc queries) | |||
macro copy/paste data from multiple cells to multiple cells | Excel Discussion (Misc queries) | |||
How to copy multiple cells between worksheets | Excel Discussion (Misc queries) | |||
List box, copy multiple Cells | Excel Worksheet Functions | |||
copy multiple cells | Excel Programming |