I have the following code that copies rows from another sheet to the current sheet at a given location. ws2 and ws3 are worksheets.
ws3.Range(ws3.Cells(4, 1), ws3.Cells(4,2)).Copy ws2.Cells(2, 2)
How do I change this code to paste only the values of the cells? Current working code copies cells with formulas. I would like to know how to pass pasteSpecial parameters as below ?
ws3.Range(ws3.Cells(4, 1), ws3.Cells(4,2)).Copy ws2.Cells(2, 2).PasteSpecial = xlPasteValues
CodePudding user response:
Break it into two lines and use a parenthesis rather than an =
sign.
ws3.Range(ws3.Cells(4, 1), ws3.Cells(4,2)).Copy
ws2.Cells(2, 2).PasteSpecial (xlPasteValues)