+ Reply to Thread
Results 1 to 3 of 3

delete rows based on a filter criteria - VBA

  1. #1
    Registered User
    Join Date
    04-16-2009
    Location
    Copenhagen, Denmark
    MS-Off Ver
    Excel 2003
    Posts
    5

    delete rows based on a filter criteria - VBA

    Hi,
    I'm trying to delete rows based on a filter criteria, but I keep getting run-time error '1004' on the highlighted line. Here is what I have, can anyone help?

    Please Login or Register  to view this content.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: delete rows based on a filter criteria - VBA

    Why the offset? That could be slipping in rows that are hidden.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243

    Re: delete rows based on a filter criteria - VBA

    hi all,

    JB, The use of "specialcells" prevents hidden rows being included. I suspect the offset is to ignore the header row.

    acs013, You have error checking early in your code but it appears you have none to identify if there are actually visible cells once the filter is applied & this may be your problem. Here is an unmodified function from my work which you may be able to adapt & include in your macro:
    Please Login or Register  to view this content.
    hth
    Rob
    Rob Brockett
    Kiwi in the UK
    Always learning & the best way to learn is to experience...

+ 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