运行时错误'-2147417848(80010108)对象调用已与vba中的客户端错误断开连接

时间:2018-04-12 12:01:13

标签: excel-vba vba excel

每当我尝试运行宏时,我都会收到“对象调用错误”。错误行

Columns("B:B").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove

如果我试图跳过这一行,我的立即行中的“NumberFormat”错误收到错误

dim num as integer, rownumber as integer
Columns("B:B").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Range("B5").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(RC[5]:RC[" & Num & "])" --> number of columns to be averaged
Columns("B:B").Select
Selection.NumberFormat = "General"
Range("B5").Select
rownum= Range("B5").End(xlDown).Row ---> last row
Range("C5").Select

Selection.AutoFill Destination:=Range("C5:C" & rownum)
Range("C5").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy

Range("B5").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
Application.CutCopyMode = False

请任何人,建议我摆脱这个错误的想法

注意:我尝试了以下链接中提供的解决方案,但没有一个解决方案有效。

Object invoked has disconnected from its clients when inserting row

Excel VBA "Automation Error: Object Invoked has disconnected from its clients"

提前致谢!!!

0 个答案:

没有答案