总是出现438运行时错误,请帮我看一下下面这段excle宏代码,什么地方有问题
总是出现438运行时错误,请帮我看一下下面这段代码,什么地方有问题
Sheets(oldRiskDate).Select
Dim itemNO As String
Dim itemDate As String
itemNO = Sheets(oldRiskDate).Cells(7 + items, 1)
itemDate = Sheets(oldRiskDate).Cells(7 + items, 2)
Sheets(oldRiskDate).Rows(7 + items).Select
Selection.Copy
Sheets(SheetName2).Select
For j = 7 To Sheets(SheetName2).UsedRange.Rows.Count - 3
If itemDate = Sheets(SheetName2).Cells(j, 2) And itemNO = Sheets(SheetName2).Cells(j, 1) Then
Sheets(SheetName2).Range("A" & CStr(j)).Select
Selection.Paste Shift:=xlDown
Application.CutCopyMode = False
Exit For
End If
Next j
[解决办法]
Shift:=xlDown
是原行自动下移
paste 不需要
[解决办法]
Selection.Paste Shift:=xlDown ? Selection.Paste Destination:=xlDown
[解决办法]
实在不行:将
Sheets(SheetName2).Range("A" & CStr(j)).Select
Selection.Paste Shift:=xlDown
这两句改为:
Sheets(SheetName2).Range("A" & CStr(j)).Select
Sheets(SheetName2).Paste
总是出现438运行时异常,请帮小弟我看一下下面这段excle宏代码,什么地方有有关问题
总是出现438运行时错误,请帮我看一下下面这段excle宏代码,什么地方有问题总是出现438运行时错误,请帮我看
