Hi,

I'm trying to do a paste special (values) of Excel data into an Excel sheet but coding it from word VBA. I can get a normal past to work however with the paste special the 'Paste' argument is not recognised.

I have tried the following (only the paste special line has problems)with no luck and have also tried changing "xlPasteValues" for just "xlValues"

I was wondering if anyone would be able to figure out what I'm doing wrong? Thanks.

With Wb.activesheet
            .Cells(startRow + (2 * i), 1).EntireRow.Insert
            Xl.CutCopyMode = False
           .Range(.Cells(1, 1), .Cells(1, 1).End(xlToRight)).Copy
           .Cells(startRow + (2 * i), 1).Select
           .Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=True, Transpose:=False
           .Selection.Font.Bold = True
    End With

If you need any more information please do just ask.

Thanks
Robyn

Hey, Sorry guys don't worry about this as I think I've found the solution.

I discuvered this post and have since got it all working. http://www.foxite.com/archives/paste-special-in-excel-0000088384.htm

The code I am now using is:

With Wb.activesheet
            .Cells(startRow + (2 * i), 1).EntireRow.Insert
            Xl.CutCopyMode = False
            .Range(.Cells(1, 1), .Cells(1, 1).End(xlToRight)).Copy
            .Cells(startRow + (2 * i), 1).Select
            Xl.Selection.PasteSpecial (-4163)
            Xl.Selection.Font.Bold = True
    End With

-4163 being the code for past values.

Thanks anyway and I'm sure I'll be back

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.