+ Reply to Thread
Results 1 to 2 of 2

Countif and Delete Macro/Formula Issues

  1. #1
    Registered User
    Join Date
    08-06-2015
    Location
    Mesa, Arizona
    MS-Off Ver
    Microsoft Excel 2013
    Posts
    84

    Countif and Delete Macro/Formula Issues

    I have a formula in M2 that goes down to the last row and looks for the value "0" in the specified column and if the value is present it will show "delete"

    Then in N2 I have a countif formula that will take the data and delete the rows with that value.

    This works perfectly UNLESS the count is 0 - I had to add +1 as well because before I did that it would always exclude the last row with that value. The sheet has a header row so I don't want that to get deleted.

    Is there a better way to write this? I have this formula throughout my macro several times and don't want to gamble on whether or not there will always be the value needed to ensure the macro doesn't cause this problem.



    Please Login or Register  to view this content.
    Last edited by ashley72788; 12-01-2017 at 12:08 PM.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2404
    Posts
    24,872

    Re: Countif and Delete Macro/Formula Issues

    Do you need the formulas in M and N for some reason? Or do you set them up only so the code knows what to delete? If the latter, this code is a very convoluted way to do this.

    You also have macro recorder bloat in the code.

    I would delete columns M and N and do this:

    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

+ 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] Issues with Index/CountIF Formula
    By gilpin004 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-08-2017, 01:40 PM
  2. Formula issues with macro recorder
    By leaveit2bevo in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-17-2013, 09:46 PM
  3. COUNTIF & VLOOKUP Formula Issues
    By xcelhelp in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-09-2013, 04:11 PM
  4. [SOLVED] Issues with a Countif
    By Cmorgan in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 08-19-2013, 04:52 AM
  5. Macro to delete macro button issues
    By Dibbley247 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-04-2013, 07:10 AM
  6. Macro Sheet & Formula Name Issues
    By ZHertz in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-17-2011, 05:36 PM
  7. Replies: 1
    Last Post: 08-19-2010, 03:31 PM

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