Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
On "Sheet1" I have a command button to:
1) copy a range of cells on "Sheet2" 2) paste copied values back into "Sheet1" The following set of instructions seem to work. Private Sub CommandButton1_Click() Sheets("sheet2").Select Sheets("Sheet2").Range("A1:J10").Select Selection.Copy Sheets("Sheet1").Select Sheets("Sheet1").Activate Range("A1").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False End Sub The instructions below doesn't work. Private Sub CommandButton1_Click() Sheets("sheet2").Select Sheets("Sheet2").Range(Cells(1, 1), Cells(10, 10)).Select 'offending line Selection.Copy Sheets("Sheet1").Select Sheets("Sheet1").Activate Range("A1").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False End Sub The offending line is the third line with ".Range(...)" in it. The second method seems to work if I copy/paste cells from the same sheet. I would like to use numeric values to set the range because the table of values that I want to copy on "Sheet2" will change. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Running Macros by selecting from a dropdown list | Excel Discussion (Misc queries) | |||
selecting 2 ranges, 1 Worksheet, printing on 1 page PDF | Excel Discussion (Misc queries) | |||
By selecting cells adjacent to cells tally sheet | Excel Worksheet Functions | |||
selecting different cell ranges across sheets, to display on summary page | Excel Discussion (Misc queries) | |||
macros on one page | Excel Discussion (Misc queries) |