范围对象的VBA插入方法失败/对象调用

我已经阅读了许多解决scheme,但没有工作…我的代码已经工作正常2个星期,但现在它在下面的行失败: Sheets("Order Forms").Range(Cells(25 + intAbove, intCol - 3), Cells(25 + intAbove, intCol + 1)).Insert Shift:=xlDown

我已经尝试通过使用Select ,然后Selection重写,但没有任何工作。 如果我先运行一些其他macros,它仍然有效。 我得到了这个问题中提到的两个错误。

这是我的整个过程,如果有帮助…

 Sub Modify_List(ByVal intNewVal As Integer, ByVal intOldVal As Integer, strType As String, intCol As Integer) Dim intA1 As Integer Dim intA2 As Integer Dim intAbove As Integer Dim i As Integer Application.ScreenUpdating = False Select Case strType Case "Standard User Phones - Cisco 7965" intAbove = 0 intCol = intCol + 1 Case "Public Space Phones - Cisco 7965" intAbove = Cells(17, intCol - 1).Value If intAbove > 0 Then intAbove = intAbove + 2 End If Case "Public Space Phones - Cisco 8831" intA1 = Cells(17, intCol - 1).Value intA2 = Cells(17, intCol).Value If intA1 + intA2 = 0 Then intAbove = 0 ElseIf intA1 = 0 Then intAbove = intA2 + 2 ElseIf intA2 = 0 Then intAbove = intA1 + 2 Else intAbove = intA1 + intA2 + 4 End If End Select Select Case intNewVal Case Is = intOldVal 'do nothing Case Is < intOldVal 'remove rows If intNewVal = 0 Then 'remove header and lines Range(Cells(25 + intAbove, intCol - 3), Cells(26 + intAbove + intOldVal, intCol + 1)).Delete Shift:=xlUp Cells(20, intCol).Select Else 'remove ending lines Range(Cells(26 + intAbove + intNewVal + 1, intCol - 3), Cells(26 + intAbove + intOldVal, intCol + 1)).Delete Shift:=xlUp Cells(26 + intAbove + intNewVal, intCol - 2).Select End If Case Is > intOldVal 'add rows If intOldVal = 0 Then 'add header and lines SheetAU.Range("B1").Value = strType SheetAU.Range("A1:E2").Copy 'ActiveWorkbook.Sheets("Order Forms").Activate **Sheets("Order Forms").Range(Cells(25 + intAbove, intCol - 3), Cells(25 + intAbove, intCol + 1)).Insert Shift:=xlDown** Application.CutCopyMode = False For i = 1 To intNewVal SheetAU.Range("A3:E3").Copy Sheets("Order Forms").Range(Cells(26 + intAbove + i, intCol - 3), Cells(26 + intAbove + i, intCol + 1)).Insert Shift:=xlDown Application.CutCopyMode = False Cells(26 + intAbove + i, intCol - 3).Value = i Next Cells(27 + intAbove, intCol - 2).Select Else 'insert extra lines For i = intOldVal + 1 To intNewVal SheetAU.Range("A3:E3").Copy Sheets("Order Forms").Range(Cells(26 + intAbove + i, intCol - 3), Cells(26 + intAbove + i, intCol + 1)).Insert Shift:=xlDown Application.CutCopyMode = False Cells(26 + intAbove + i, intCol - 3).Value = i Next Cells(26 + intAbove + intOldVal + 1, intCol - 2).Select End If End Select Application.ScreenUpdating = True 

结束小组