Special paste by values, variable not found

Lifeseeker

Registered User.
Local time
Yesterday, 20:24
Joined
Mar 18, 2011
Messages
273
Hi there,

I'm trying to paste the values of worksheet 1 by value. Please see the attached two files.

When I run the code, it indicates that variable ( xlpastevalues) is not defined.

It is not a variable....

can someone help?

Code:
Private Sub Command0_Click()


  Dim xlApp As Object
       
        Set xlApp = CreateObject("Excel.Application")
       
        xlApp.Visible = True
        xlApp.Workbooks.Open "Your location\metric_DEV.xls", True, False
        
        With xlApp.activeworkbook.worksheets("Metric summary")
        .usedrange.copy
        .range("A1").pasteSpecial paste:=xlPasteValues
    End With
End Sub

Can someone help?

Thanks
 

Attachments

try changing it to this (make your selection range how you want it):


.Range("A1:Z100").Copy
.Range("A1").Select

.Selection.PasteSpecial Paste:=xlPasteValues

Range("A1").Select

Application.CutCopyMode = False
 

Users who are viewing this thread

Back
Top Bottom