+ Reply to Thread
Results 1 to 4 of 4

Need message box stating number of rows deleted by macro

  1. #1
    Registered User
    Join Date
    11-07-2008
    Location
    St. Louis, Missouri, USA
    MS-Off Ver
    2003
    Posts
    50

    Need message box stating number of rows deleted by macro

    I have a macro that deletes rows in a spreadsheet if the patient's age is less than 17. [
    Please Login or Register  to view this content.
    What I need the macro to do now is display a message box that tells me how many rows were deleted. I can get the macro to display a message box, but I can't get it to count the deleted rows.

  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: Need message box stating number of rows deleted by macro

    Try this:
    Please Login or Register  to view this content.
    _________________
    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
    Registered User
    Join Date
    11-07-2008
    Location
    St. Louis, Missouri, USA
    MS-Off Ver
    2003
    Posts
    50

    Re: Need message box stating number of rows deleted by macro

    Thanks for the suggestion. However there appears to be a bug somewhere. Depending on what numbers are entered in column D, the output of the macro is either correct, yeilds an incorrect number, or yields a negative number.

    See the attached worksheet
    Attached Files Attached Files
    Last edited by shg; 09-10-2009 at 04:45 PM. Reason: deleted spurious quote

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

    Re: Need message box stating number of rows deleted by macro

    Take out this line of code from where it is and move it all the way up the top, under the DIMs...
    Please Login or Register  to view this content.

+ 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