+ Reply to Thread
Results 1 to 11 of 11

Delete method of range class failed - run time error 1004

  1. #1
    Forum Contributor
    Join Date
    06-20-2011
    Location
    Auckland, NZ
    MS-Off Ver
    Excel 2013
    Posts
    165

    Delete method of range class failed - run time error 1004

    Hi Guys,

    I have a code which gives me an error. Its a lengthy code and gives me an error "delete method of range class failed - run time error 1004". Can someone give me an easy alternative to the lengthy code. Thanks in advance.

    Code->
    Please Login or Register  to view this content.
    Cheers
    plasma33

  2. #2
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    2007
    Posts
    3,475

    Re: Delete method of range class failed - run time error 1004

    Hi plasma33,

    The error message is due to the fact that the "Table" tab is protected and therefore you cannot delete any row(s) from it.

    Once you've unprotected you can either use you code, or you can try this (initially on a copy of the tab as the results cannot be undone if they're not as expected):

    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 Contributor
    Join Date
    06-20-2011
    Location
    Auckland, NZ
    MS-Off Ver
    Excel 2013
    Posts
    165

    Re: Delete method of range class failed - run time error 1004

    perfect that worked like i wanted.....i am gonna mark the thread as solved....thanks again for helping

    Cheers
    plasma33

  4. #4
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    2007
    Posts
    3,475

    Re: Delete method of range class failed - run time error 1004

    Thanks for letting us know and you're welcome. Thanks also for adding a point to my reputation

  5. #5
    Forum Contributor
    Join Date
    06-20-2011
    Location
    Auckland, NZ
    MS-Off Ver
    Excel 2013
    Posts
    165

    Re: Delete method of range class failed - run time error 1004

    You are welcome dude....actually its not working now...it was working fine before....but its giving me the same error again.......its giving me that error at->

    Please Login or Register  to view this content.
    Waiting for your reply...Thanks in advance...

    Cheers
    plasma33

  6. #6
    Forum Contributor
    Join Date
    06-20-2011
    Location
    Auckland, NZ
    MS-Off Ver
    Excel 2013
    Posts
    165

    Re: Delete method of range class failed - run time error 1004

    Hi again,

    Is there an alternative to the above code like a more simpler or a different one??? Coz I tried most of the solutions that said on the internet for that particular error but still not working.....

    Cheers
    plasma33

  7. #7
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    2007
    Posts
    3,475

    Re: Delete method of range class failed - run time error 1004

    That's odd it's failing there

    Are you sure the "Table" tab isn't protected?

  8. #8
    Forum Contributor
    Join Date
    06-20-2011
    Location
    Auckland, NZ
    MS-Off Ver
    Excel 2013
    Posts
    165

    Re: Delete method of range class failed - run time error 1004

    yeh i am sure the table tab isn't protected....at first i did manually from going to Home-> Format Cells -> Protection and Unchecking the Locked....but when I tried running the macro it changes back to protected...donno why its doing it....but then I made a macro for unchecking/unprotecting the tab....here is the code for it->

    Please Login or Register  to view this content.
    Cheers
    plasma33

  9. #9
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    2007
    Posts
    3,475

    Re: Delete method of range class failed - run time error 1004

    That just unlocks cell P15 - it doesn't unprotect the tab if it is protected

    I'd say the tab is protected which is causing the error. To check, click on the Review ribbon and if the first option in the Changes tab says Unprotect Sheet, the tab is protected.

    Not sure, but as you can write to the tab see if replacing this line of my code...

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

    Please Login or Register  to view this content.
    Robert
    Last edited by Trebor76; 06-28-2012 at 02:12 AM.

  10. #10
    Forum Contributor
    Join Date
    06-20-2011
    Location
    Auckland, NZ
    MS-Off Ver
    Excel 2013
    Posts
    165

    Re: Delete method of range class failed - run time error 1004

    Working fine now...i just changed to a new worksheet and deleted the old worksheet....and its working algud so far....thanks for all your help mate...will wait and c how it goes and will try your solution too....

    Cheers
    plasma33

  11. #11
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    2007
    Posts
    3,475

    Re: Delete method of range class failed - run time error 1004

    Glad to hear it's all sorted

+ 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