+ Reply to Thread
Results 1 to 4 of 4

Run-time error '1004': Delete method of Range class failed

  1. #1
    Registered User
    Join Date
    07-09-2014
    Location
    Dorset
    MS-Off Ver
    2013
    Posts
    2

    Run-time error '1004': Delete method of Range class failed

    I am trying to delete rows that DON'T contain certain names, the code I currently have is:

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    The issue is that when I run this code it gets to the end and succesfully deletes the unwanted rows but then comes up with an error :

    Run-time error '1004': Delete method of Range class failed

    If i choose to debug it highlights the following code:

    Please Login or Register  to view this content.
    I can't work out what the problem is, if i remove the NOT from the code and make it delete the rows i wish to keep the code works perfectly fine.

    If anyone has any ideas that would be great!!

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Run-time error '1004': Delete method of Range class failed

    Hi,

    Personally I'd avoid a looping procedure to do this sort of stuff. Using a Data filter is the fastest way I know and far more efficient than a loop.

    So set up a horizontal criteria list with your consultant names and name this range say "crit". Put ="<>John Smith" etc. in the second row of the criteria. Name the range you're trying to filter 'Data"

    Then something like

    Please Login or Register  to view this content.
    Last edited by zbor; 07-17-2014 at 07:04 AM.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    07-09-2014
    Location
    Dorset
    MS-Off Ver
    2013
    Posts
    2

    Re: Run-time error '1004': Delete method of Range class failed

    Thanks for you help, but i dont really understand what you mean by a horizontal criteria list. Could you please explain a little more?

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Run-time error '1004': Delete method of Range class failed

    Hi,

    I simply mean put the column label of the column that contains the consultant names in say cells A1:I1 (i.e. nine cells) and then in
    A2 put <>John Smith
    B2 put <>Juilian Den
    ...etc

    and name A1:I2 'Crit'

+ 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] Run Time Error '1004': Select method of Range Class failed VBA
    By jcgonzales in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-19-2014, 01:39 AM
  2. Replies: 1
    Last Post: 01-07-2014, 01:08 AM
  3. [SOLVED] Run-time error '1004' ; Delete method of Range Class failed
    By Adam1987 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-14-2012, 06:43 AM
  4. [SOLVED] Delete method of range class failed - run time error 1004
    By plasma33 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-28-2012, 07:37 AM
  5. Run-time error '1004' - Select method of Range class failed
    By g10drac in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-08-2011, 08:03 PM

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