+ Reply to Thread
Results 1 to 9 of 9

Run-Time Error

  1. #1
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Run-Time Error

    How would I go about amending this code on the 'InsertRows' macro (Crtl i), so that I don't get a Run-time error '13', when the cancel button is clicked on the dialogue box?

    Please Login or Register  to view this content.
    Many thanks...
    Attached Files Attached Files

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

    Re: Run-Time Error

    Hi there,

    Try this:

    Please Login or Register  to view this content.
    Regards,

    Robert
    ____________________________________________
    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
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Run-Time Error

    Try this

    Please Login or Register  to view this content.
    Note that J is no longer defined as Long which allows it to take a string value as well. I've added a type argument to the input box to force a number being added.
    Martin

  4. #4
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Re: Run-Time Error

    Hi Trebor76,

    This still gives the same error...

  5. #5
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Re: Run-Time Error

    Hi mrice,

    This removes the error, however, it also inserts two blank rows above the selected cell (rather than below it as in the original), even when nothing is entered into the dialoue box?

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

    Re: Run-Time Error

    For mrice's solution replace this line...

    Please Login or Register  to view this content.
    ...with this:

    Please Login or Register  to view this content.
    As for my code I'm not sure as it worked fine for me

    Robert

  7. #7
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Run-Time Error

    Ooopss

    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Re: Run-Time Error

    Hi Trebor76

    Weird, tried your code again and yes, it is all working correctly, must have been something I did! You're suggested change to mrice's code also fixed the problem.

    Many thanks
    Last edited by HangMan; 12-08-2012 at 07:36 PM.

  9. #9
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Re: Run-Time Error

    Hi mrice,

    Trebor76' tweak fixed your code, plus your revision also works, so many thanks for your help.

  10. #10
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Re: Run-Time Error

    Hi mrice,

    Trebor76' tweak fixed your code, plus your revision also works, so many thanks for your help.

+ 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