none
Excel VBA RRS feed

  • Question

  • Hello All,

            I am getting the "object invoked error"(runtime error '-2147417848(80010108)Object Invoked has disconnected from its client's error in VBA)whenever I tried to run my macro. The error line

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

    Please, anyone, suggest me an idea to get rid of this error

    Thanks in Advance!!!

    Friday, April 13, 2018 1:25 PM

All replies

  • S,
    re:  code error

    Possibilities...
    1.  You have DisplayAlerts turned off and there is data in the last worksheet column.
    2.  You are using a older version of Excel that does not recognize the CopyOrigin argument.
    3.  The worksheet/workbook might be protected.

    You could try unprotecting the workbook, clearing the last column and then testing this version...
      Columns("B:B").Insert Shift:=xlToRight

    Also, It might help if you specified the workbook and worksheet...
      ThisWorkbook.Worksheets("insert name").Columns("B:B").Insert Shift:=xlToRight

    Note:  the worksheet name is the exact text (including spaces) displayed on the worksheet tab.

    '---
    Jim Cone
    https://goo.gl/IUQUN2


    • Edited by James Cone Saturday, April 14, 2018 5:19 PM spelling
    Saturday, April 14, 2018 5:17 PM