+ Reply to Thread
Results 1 to 10 of 10

VBA code delete row (where am I going wrong) please help

  1. #1
    Registered User
    Join Date
    08-09-2022
    Location
    Manitoba, Canada
    MS-Off Ver
    2010 & 365
    Posts
    3

    VBA code delete row (where am I going wrong) please help

    Hi to everyone,

    (New member)

    A very Novice/beginner with using VBA, I created this small routine, I thought it was working but then after using the routine a few times it stops with the following error code;

    'run time error 2147417848(80010108)'
    Method 'Insert' Object 'Range' failed


    I know I have made a huge mistake somewhere along the line, and I've spent quite a few days trying to get it to work but now grinded to a halt, so I'm hoping someone could possibly help me in correcting my mistake?

    Idea is this, cut the ranged row ("C1:U1") from active sheet and paste it into the next available row in the sheet called "TO BE CLOSED", It works for a few times say 8,9 or 10 times then suddenly stops and reports the error!

    Huge thanks in advance, code as follows;


    Please Login or Register  to view this content.

    again thanks in advanced its really appreciated.

  2. #2
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,527

    Re: VBA code delete row (where am I going wrong) please help

    Hi Ram_1967,

    Welcome to the forum!!

    Without seeing the workbook it's hard to diagnose (there be an image or something in one of the cells??) but let me know how this goes:

    Please Login or Register  to view this content.
    Regards,

    Robert
    Last edited by Trebor76; 08-10-2022 at 12:24 AM.
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  3. #3
    Valued Forum Contributor
    Join Date
    08-08-2022
    Location
    Buenos Aires
    MS-Off Ver
    Excel 2019
    Posts
    1,777

    Re: VBA code delete row (where am I going wrong) please help

    Hello. You can try with:

    Please Login or Register  to view this content.
    Or

    Please Login or Register  to view this content.
    the one you like best.
    Last edited by beyond Excel; 08-09-2022 at 09:19 PM.

  4. #4
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,558

    Re: VBA code delete row (where am I going wrong) please help

    What do you get when you run this?
    Please Login or Register  to view this content.
    Experience trumps academics every day of the week and twice on Sunday.

  5. #5
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,158

    Re: VBA code delete row (where am I going wrong) please help

    Quote Originally Posted by Ram_1967 View Post
    ... cut the ranged row ("C1:U1") from active sheet and paste it into the next available row in the sheet called "TO BE CLOSED" ...
    1. Do these activities take place within one workbook ?
    2. What is the name of the worksheet with range "C1:U1" and are there merged cells in this worksheet ?
    3. Is there maybe a rows overflow in the sheet "TO BE CLOSED" ? (worksheet has 1048576 rows only)
    4. In the content you write about "the next available row", but in the code you have something else (you insert "the next row" in the place of cell "A2") ?

  6. #6
    Registered User
    Join Date
    08-09-2022
    Location
    Manitoba, Canada
    MS-Off Ver
    2010 & 365
    Posts
    3

    Re: VBA code delete row (where am I going wrong) please help

    Hi to all, and thanks for all the replies, I have attached a simple workbook with examples for better explanation, again thanks to all for your help it is very much appreciated.
    Attached Files Attached Files

  7. #7
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,558

    Re: VBA code delete row (where am I going wrong) please help

    But we never got an answer on Post #4 which should be used on the original workbook.

  8. #8
    Valued Forum Contributor
    Join Date
    08-08-2022
    Location
    Buenos Aires
    MS-Off Ver
    Excel 2019
    Posts
    1,777

    Re: VBA code delete row (where am I going wrong) please help

    Quote Originally Posted by Ram_1967 View Post
    I have attached a simple workbook with examples for better explanation...
    Let's go again:
    a) Select any cell in the row to move.
    b) Run the macro.
    c) Check the result.

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    08-09-2022
    Location
    Manitoba, Canada
    MS-Off Ver
    2010 & 365
    Posts
    3

    Re: VBA code delete row (where am I going wrong) please help

    Awsome thanks 'Beyond Excel' That last code worked and thanks to everyone else who replied, I forgot to mention in my last post that I tried them all and they didnt work exactly they way I wanted it to, but Beyond Excel last code worked perfectly, again thanks for your time its very much appreciated.indeed.

  10. #10
    Valued Forum Contributor
    Join Date
    08-08-2022
    Location
    Buenos Aires
    MS-Off Ver
    Excel 2019
    Posts
    1,777

    Re: VBA code delete row (where am I going wrong) please help

    Quote Originally Posted by Ram_1967 View Post
    Awsome thanks 'Beyond Excel' That last code worked and thanks to everyone else who replied, I forgot to mention in my last post that I tried them all and they didnt work exactly they way I wanted it to, but Beyond Excel last code worked perfectly, again thanks for your time its very much appreciated.indeed.
    Luckily we reached the finish line because the options were running out, hahaha

+ 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. Delete - posted in wrong section
    By LeanAccountant in forum Excel General
    Replies: 0
    Last Post: 04-15-2019, 11:10 AM
  2. [SOLVED] Please, help me with the code for Similarity Factor Calc. My code gives wrong number.
    By Invictus1 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-22-2015, 09:52 PM
  3. Replies: 3
    Last Post: 10-03-2015, 10:30 PM
  4. Code for email alerts from excel isn't working, wrong code possibly?
    By jessthorogood in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-27-2012, 01:45 AM
  5. Wrong line of code banned me out and can't access vba code...
    By albertc in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 05-14-2012, 02:41 PM
  6. Delete all given values gives wrong select?
    By Reinder in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-22-2007, 03:18 AM

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