ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA Pasting (https://www.excelbanter.com/excel-programming/377211-vba-pasting.html)

RLang

VBA Pasting
 
Hi,
I realize this is probably incredibly simple but I've somehow lost my
ability to do a paste special command in VB that was previously working.
Excel returns an error
"PasteSpecial method of range class failed". It happens from a module level
routine or worksheet level. As a side note, I've found at different times in
the past that my environment occassionally doesn't recognize other common
Excel constants and to get the ball rolling, I sometimes have to use a
literal in place of the constant name. I have Excel 2003 w/ Service Pack 2.

Worksheets("Sheet1").Range("aw7:ba7").Copy
Worksheets("Sheet1").Range("aw7:ba7").PasteSpecial xlPasteValues

Thanks much,

Jim Thomlinson

VBA Pasting
 
You actually do not need to paste special in this case if you don't want
to... Try this...

with Worksheets("Sheet1")
.Range("aw7:ba7").Value = .Range("aw7:ba7").Value
end with

That being said your posted code should work. Ensure that the sheet is not
protected...
--
HTH...

Jim Thomlinson


"RLang" wrote:

Hi,
I realize this is probably incredibly simple but I've somehow lost my
ability to do a paste special command in VB that was previously working.
Excel returns an error
"PasteSpecial method of range class failed". It happens from a module level
routine or worksheet level. As a side note, I've found at different times in
the past that my environment occassionally doesn't recognize other common
Excel constants and to get the ball rolling, I sometimes have to use a
literal in place of the constant name. I have Excel 2003 w/ Service Pack 2.

Worksheets("Sheet1").Range("aw7:ba7").Copy
Worksheets("Sheet1").Range("aw7:ba7").PasteSpecial xlPasteValues

Thanks much,



All times are GMT +1. The time now is 02:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com