Insert and move down fail?

  • I had the first code working fine, and amended it to the second. Now I get an "Insert method of Range class failed" message and the line "Selection insert..." is highlighted by the Debugger. Any solutions please? Basically every 5 seconds row 5 ranges are populated with fresh values. They get offset pasted to row 7 and previous pastes get shunted down by one row. The only other difference between the two versions is row 7 is now the next row after the header row of Tables. I did this so that formulas above become dynamic as the table expands.


  • Re: Insert and move down fail?


    It would be far easier if we could see your workbook, please attach it.
    [sw]*[/sw]

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • Re: Insert and move down fail?


    Thanks for your reply.
    The workbook is connected to a 3rd party application that updates values. There are two sheets, Sheet1 and PLACE. They are updated several times a second and sheet DATA responds to them. For your purposes, you won't be able to see it run in auto mode unfortunately. If you look at sheet DATA, you will see that when I ticked 'tick to record' box, row 5 cells were populated with values after 5 seconds. These cell ranges were offset pasted to row 7 ranges, which then would push the previous row 7 contents down to row 8 and so-on and so-forth. Unfortunately it timed out with the error on doing that, and remained with values in row 7 only. I'm dubious as to your success in analysing the problem without the live feed. Good luck, and thanks for your interest.

  • Re: Insert and move down fail?


    Inserting a row fails because the excel built-in tables form part of the row you are trying to insert. Try this:

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • Re: Insert and move down fail?


    Thanks KjBox, that code is masterful! You're in another stratosphere of advanced coders. It's a tad slow, takes about 3 secs to paste, but that's liveable.


    Cheers

  • Re: Insert and move down fail?


    You're welcome.


    Yes I know it is slowish, but I thought not too slow to be used as a stable and dynamic code.


    By dynamic I mean that if, in the future, you need to add a new table or remove an existing one then the code will not need changing. If you do remove a table you will need to change the names of the remaining tables beyond the one that was removed, so that the table names remain as "Table1", Table2", "Table3".... and so on up to the last table.

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • Re: Insert and move down fail?


    Try this, the code no longer uses copy/paste and is faster.

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • Re: Insert and move down fail?


    A true legend! Not enough to do it well, just have to do it better. The sort of person we need in this world!

  • Re: Insert and move down fail?


    Thank you :)

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!