Paste Values

marav08

New Member
Joined
Sep 22, 2017
Messages
6
Hi
Quick question
I'm trying to copy a data from one worksheet to another.
I can now copy the data the only problem is it has a formula.
What im trying to paste is the values only and no longer will copy the formula.

Here is my code

Code:
Sub Button1_Click()

    Dim source As Worksheet
    Dim destination As Worksheet
    Dim emptyColumn As Long
    Set source = Sheets("AHT Per Skill Daily")
    Set destination = Sheets("AHT Summary")
    'find empty Column (actually cell in Row 1)'
    emptyColumn = destination.Cells(3, 1).End(xlToRight).Column
    
    If emptyColumn > 1 Then
        emptyColumn = emptyColumn + 1
    End If
    source.Range("AH20:AH36").Copy destination.Cells(3, emptyColumn)
    
 
    
 End Sub
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Hi,

Tried to code the following.

Code:
Sub Button1_Click()


    Dim source As Worksheet
    Dim destination As Worksheet
    Dim emptyColumn As Long
    Set source = Sheets("AHT Per Skill Daily")
    Set destination = Sheets("AHT Summary")
   ' find empty Column (actually cell in Row 1)'
    emptyColumn = destination.Cells(3, 1).End(xlToRight).Column
    
    If emptyColumn > 1 Then
        emptyColumn = emptyColumn + 1
    End If
    source.Range("AH20:AH36").Copy destination.Cells(3, emptyColumn)
    source.Range("C3").PasteSpecial xlPasteValues
    
   
   
 End Sub

Pastespecial method of range class failed is the error
 
Upvote 0
Try replacing this:
Code:
    source.Range("AH20:AH36").Copy destination.Cells(3, emptyColumn)
    source.Range("C3").PasteSpecial xlPasteValues

with:

Code:
    source.Range("AH20:AH36").Copy 
    destination.Cells(3, emptyColumn).PasteSpecial xlPasteValues
 
Upvote 0

Forum statistics

Threads
1,224,748
Messages
6,180,721
Members
452,995
Latest member
isldboy

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