运行时错误1004 Range Class字段的Pastespecial方法 [英] Runtime-time Error 1004 Pastespecial method of Range Class field
问题描述
嗨:我们刚升级到Windows 7& Office 10和我的一个宏现在挂起了运行时1004"Range类的Pastespecial方法失败。我查看了链接,但没有看到或理解这些解决方案。
以下是我收到错误消息部分的代码。
'Application.CutCopyMode = False
'表格("PO")。复印
'ActiveWorkbook.SaveAs文件名:= _
$
"    " g:\ Raw Materials \ Stock Board PO \&范围(L52).Value",FileFormat:= _
"     xlNormal,密码:="",WriteResPassword:="",ReadOnlyRecommended:= False _
"     ,CreateBackup:= False
'ActiveWindow.Close
ActiveWindow.SelectedSheets.PrintOut Copies:= 2,Collate:= True
范围("B52:g52")。选择
Selection.Copy
表格("列表")。选择
Application.Goto参考:=" R20000C1"
Selection.End(xlUp)。选择
ActiveCell.Offset(1,0)。选择
Selection.PasteSpecial Paste:= xlPasteValues,Operation:= xlNone,SkipBlanks:= False,Transpose:= False
表格("PO")。选择
范围("J5:M5,J3:K3,J1:K1")。选择
范围("J1")。激活
Application.CutCopyMode = False
Selection.ClearContents
问候
Frank
我复制了你的代码(或它的一部分,似乎工作正常。但是你已经编写了代码移动光标,这是非常慢的运行,不推荐尝试下面的test2。
子测试()
范围(" B52:g52") .Select
Selection.Copy
Sheets(" List")。Select
Application.Goto Reference:=" R20000C1"
Selection.End(xlUp).Select
ActiveCell.Offset(1,0).Select
Selection.PasteSpecial Paste:= xlPasteValues,Operation:= xlNone,SkipBlanks:= False,Transpose:= False
End Sub
Sub Test2()
范围(" B52:g52")。复制
使用工作表(" List")
.Cells(.Cells.SpecialCells(xlCellTypeLastCell).Row + 1,1).PasteSpecial _
粘贴:= xlPasteValues,Operati on:= xlNone,SkipBlanks:= False,Transpose:= False
End
End Sub
Hi: We just upgraded to Windows 7 & Office 10 and one of my macro's now hang up with the run-time 1004 "Pastespecial method of Range class failed. I have looked at the links but don't see or understand those solutiions.
Here is the code I currently have from the section where I get the error message.
' Application.CutCopyMode = False
' Sheets("PO").Copy
' ActiveWorkbook.SaveAs Filename:= _
' "g:\Raw Materials\Stock Board PO\& Range(L52).Value", FileFormat:= _
' xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
' , CreateBackup:=False
' ActiveWindow.Close
ActiveWindow.SelectedSheets.PrintOut Copies:=2, Collate:=True
Range("B52:g52").Select
Selection.Copy
Sheets("List").Select
Application.Goto Reference:="R20000C1"
Selection.End(xlUp).Select
ActiveCell.Offset(1, 0).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Sheets("PO").Select
Range("J5:M5,J3:K3,J1:K1").Select
Range("J1").Activate
Application.CutCopyMode = False
Selection.ClearContents
Regards
Frank
I copied your code (or part of it and it seemed to work fine. However you have written the code moving the cursor always, which is very slow to run and not recommended try test2 below instead.
Sub test() Range("B52:g52").Select Selection.Copy Sheets("List").Select Application.Goto Reference:="R20000C1" Selection.End(xlUp).Select ActiveCell.Offset(1, 0).Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False End Sub Sub Test2() Range("B52:g52").Copy With Worksheets("List") .Cells(.Cells.SpecialCells(xlCellTypeLastCell).Row + 1, 1).PasteSpecial _ Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False End With End Sub
这篇关于运行时错误1004 Range Class字段的Pastespecial方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!