+ Reply to Thread
Results 1 to 2 of 2

Autmation Error with Macro insert function

Hybrid View

amirah_almu7aka Autmation Error with Macro... 05-24-2012, 06:48 AM
Deepal Udeshi Re: Autmation Error with... 05-24-2012, 07:26 AM
  1. #1
    Registered User
    Join Date
    02-09-2012
    Location
    Tehran
    MS-Off Ver
    Excel 2010
    Posts
    18

    Autmation Error with Macro insert function

    Dear all,

    I have a big problem regarding the line written in red of the following macro:

    Sub Macro1()

    Dim cellrow As Integer
    cellrow = ActiveCell.Row

    'copy & paste entire row
    Rows(cellrow).Select
    Rows(cellrow).Copy
    Rows(cellrow + 1).Select
    Rows(cellrow + 1).Insert Shift:=xlDown

    End Sub

    when it tries to paste that specific row in the worksheet i get "Run-time error '-2147417848 (80010108)': Automation error the object invoked has disconnected from its clients"

    this error only pops up when i change the content of any unrelated cell in any other or same worksheet upon opening the excel file. that could for example just mean entering a "1" into an empty cell.
    however, if i leave the sheets untouched upon opening and perform the macro staight away i dont get that error.

    what also helps after performing any change is, saving, closing and reopening the file. in that case the macro also works.

    annoyingly enough, when i copy and insert by hand i dont get any error at any time, so it is just due to the line marked in red...

    hope that someone can help me solve this.
    thanks a lot
    michael

  2. #2
    Registered User
    Join Date
    05-24-2012
    Location
    Bombay
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Autmation Error with Macro insert function

    Hi,

    I copy paste the macro in my worksheet and its working fine. I changed the value in a cell and its still working fine.
    I am not too sure why you are getting this errorCan you attach the excel workbook for more understanding.

    Thanks,
    Deepal

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1