Paste Special

olympiac

Board Regular
Joined
Sep 26, 2010
Messages
158
How can I modify the following code to paste only the value?

Selection.Copy _
Destination:=Workbooks("name.xls").Sheets("Result").Cells(1, 1).End(xlDown).Offset(1, 0)

Thanks
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Try

Code:
Selection.Copy
Workbooks("name.xls").Sheets("Result").Cells(1, 1).End(xlDown).Offset(1, 0).PasteSpecial Paste:=xlPasteValues
 
Upvote 0
This code works:
Workbooks("name.xls").Sheets("Result").Cells(1, 1).End(xlDown).Offset(1, 0).PasteSpecial Paste:=xlPasteValues


What's wrong with this one?
Workbooks("name.xls").Sheets("Result").Cells(2, 1).PasteSpecial Paste:=xlPasteValues
 
Upvote 0
Here is the code:
If the first row in Sheet Result is empty then I want to paste the value if not I want to jump to the second row and so on.
The row is highlighted in red in my code for
Selection.Copy _
Workbooks("AccessReview Automated tool V2.xls").Sheets("Result").Cells(2, 1).PasteSpecial Paste:=xlPasteValues


CODE:

If Worksheets("Result").Cells(1, 1) = "" Then


Sheets("New").Select
Range("D8:H8").Select

Selection.Copy _
Workbooks("name.xls").Sheets("Result").Cells(1, 1)

ElseIf Worksheets("Result").Cells(2, 1) = "" Then

Sheets("New").Select
Range("D8:H8").Select

Selection.Copy _
Workbooks("name.xls").Sheets("Result").Cells(2, 1).PasteSpecial Paste:=xlPasteValues

Else

Sheets("New").Select
Range("D8:H8").Select


'Selection.Copy _
'Destination:=Workbooks("name.xls").Sheets("Result").Cells(1, 1).End(xlDown).Offset(1, 0)
Selection.Copy
Workbooks("name.xls").Sheets("Result").Cells(1, 1).End(xlDown).Offset(1, 0).PasteSpecial Paste:=xlPasteValues
 
Upvote 0
That should be on 2 separate lines of code, without the underscore at the end of the first line.

Also, you very rarely need to select sheets/cells to perform actions. For example:

Code:
Sheets("New").Select
Range("D8:H8").Select

Selection.Copy _
Workbooks("name.xls").Sheets("Result").Cells(1, 1)
could be rewritten as:
Code:
Sheets("New").Range("D8:H8").Copy Workbooks("name.xls").Sheets("Result").Cells(1, 1)
 
Upvote 0
Try

Code:
Sheets("New").Range("D8:H8").Copy
Workbooks("name.xls").Sheets("Result").Cells(Rows.Count, 1).End(xlUp).Offset(1).PasteSpecial Paste:=xlPasteValues
 
Upvote 0

Forum statistics

Threads
1,224,590
Messages
6,179,762
Members
452,940
Latest member
rootytrip

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top