+ Reply to Thread
Results 1 to 2 of 2

Inserting Rows with vba. Error:Method 'Insert' of object 'Range' failed after few attempts

  1. #1
    Registered User
    Join Date
    12-09-2009
    Location
    NY USA
    MS-Off Ver
    Excel 2016 and 2010
    Posts
    27

    Question Inserting Rows with vba. Error:Method 'Insert' of object 'Range' failed after few attempts

    Hello All.

    I have a basic VBA code that's supposed to take the highlighted cells, copy the entire row (or rows) and insert the same amount of new rows just below.

    It seemingly constantly crashes with the error after several attempts, so I was unable to pinpoint the portion of the code causing this error.

    Run-time error '-2147417848 (80010108)'
    Method 'Insert' of object 'Range' failed


    To make the situation even worse, is that after the debug window, the file freezes, and need to close the entire excel via Task Manager.

    The code for the sub is attached below, and the basic file with only the below code is attached for your convenience. Would greatly appreciate any input and possible solution to this issue.

    Thank you!!

    Please Login or Register  to view this content.
    When I go through Debug, the code that's highlighted is the actual insert procedure.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by smk224; 06-23-2020 at 02:26 PM. Reason: shortened the code, and reattached revised test file.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,425

    Re: Inserting Rows with vba. Error:Method 'Insert' of object 'Range' failed after few atte

    Can't make it fail ...

    Tidied it up a bit and set up a test harness. Run it several hundred times without it failing. Seems to slow down initially for a while and then carries on quite quickly.

    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Method range of object failed - Please help
    By Whitethorn in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-20-2018, 09:45 AM
  2. [SOLVED] RunTime Error 2147417848 -Method insert of object Range Failed
    By Vassen in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 07-14-2016, 06:58 AM
  3. help with method range of object failed
    By ammartino44 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-12-2015, 02:44 PM
  4. Replies: 3
    Last Post: 01-20-2015, 04:23 AM
  5. While inserting a column getting an error: Insert method of range class failed
    By kashif77 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-11-2014, 07:58 AM
  6. Replies: 1
    Last Post: 04-01-2014, 03:21 AM
  7. [SOLVED] Method range of object failed
    By Aland2929 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-02-2013, 06:55 AM

Tags for this Thread

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