![]() |
Run-time error '1004': PasteSpecial method of Range class failed
Hello all,
I get this error (subject line) when I run the following code: Sub PasteValuesTranspose() Dim plngScrollRow As Long Dim pintScrollColumn As Integer Dim pclcCalc As XlCalculation pclcCalc = Application.Calculation Application.Calculation = xlCalculationManual plngScrollRow = Application.ActiveWindow.ScrollRow pintScrollColumn = Application.ActiveWindow.ScrollColumn '*** The Error occurs on the following line *** Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=True Application.ActiveWindow.ScrollRow = plngScrollRow Application.ActiveWindow.ScrollColumn = pintScrollColumn Application.Calculation = pclcCalc End Sub BUT I don't get the error when I run the following (notice the commented-out lines): Sub PasteValuesTranspose() Dim plngScrollRow As Long Dim pintScrollColumn As Integer Dim pclcCalc As XlCalculation ' pclcCalc = Application.Calculation ' Application.Calculation = xlCalculationManual plngScrollRow = Application.ActiveWindow.ScrollRow pintScrollColumn = Application.ActiveWindow.ScrollColumn Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=True Application.ActiveWindow.ScrollRow = plngScrollRow Application.ActiveWindow.ScrollColumn = pintScrollColumn ' Application.Calculation = pclcCalc End Sub Can anyone explain to me what is going on here? Thanks for any help anyone can provide, Conan Kelly --------------------------- "Smokin' weed kills your brain cells. Drinkin' only screws up your liver...ya got 2 a those." - Earl Hickey (NBC's "My Name is Earl") |
Run-time error '1004': PasteSpecial method of Range class failed
What are you trying to paste? If there is nothing on the clip board then it
will probably generate the error message. "Conan Kelly" wrote: Hello all, I get this error (subject line) when I run the following code: Sub PasteValuesTranspose() Dim plngScrollRow As Long Dim pintScrollColumn As Integer Dim pclcCalc As XlCalculation pclcCalc = Application.Calculation Application.Calculation = xlCalculationManual plngScrollRow = Application.ActiveWindow.ScrollRow pintScrollColumn = Application.ActiveWindow.ScrollColumn '*** The Error occurs on the following line *** Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=True Application.ActiveWindow.ScrollRow = plngScrollRow Application.ActiveWindow.ScrollColumn = pintScrollColumn Application.Calculation = pclcCalc End Sub BUT I don't get the error when I run the following (notice the commented-out lines): Sub PasteValuesTranspose() Dim plngScrollRow As Long Dim pintScrollColumn As Integer Dim pclcCalc As XlCalculation ' pclcCalc = Application.Calculation ' Application.Calculation = xlCalculationManual plngScrollRow = Application.ActiveWindow.ScrollRow pintScrollColumn = Application.ActiveWindow.ScrollColumn Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=True Application.ActiveWindow.ScrollRow = plngScrollRow Application.ActiveWindow.ScrollColumn = pintScrollColumn ' Application.Calculation = pclcCalc End Sub Can anyone explain to me what is going on here? Thanks for any help anyone can provide, Conan Kelly --------------------------- "Smokin' weed kills your brain cells. Drinkin' only screws up your liver...ya got 2 a those." - Earl Hickey (NBC's "My Name is Earl") |
All times are GMT +1. The time now is 04:20 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com