+ Reply to Thread
Results 1 to 8 of 8

Delete Row If All Values Are Zero

  1. #1
    Registered User
    Join Date
    03-27-2013
    Location
    Wiltshire, England
    MS-Off Ver
    Excel 2007
    Posts
    75

    Question Delete Row If All Values Are Zero

    I would like a macro that deletes every row where all values on the row are zero.

    On the attached file, columns A to I are base data, so should not be assessed by the macro.
    I want the macro to start from column 10 (J) and delete the entire row if all values are zero.
    On this example I would expect a successful macro to delete rows 4 and 5.
    The total of row 3 is zero, but I would want to keep this row because it has values.

    The number of columns and number or rows on my report are always variable, but the values the macro needs to assess will always start in column 10 (J).

    Thanks for any help you can give me.

    Jonathan Williams
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Delete Row If All Values Are Zero

    Please Login or Register  to view this content.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,523

    Re: Delete Row If All Values Are Zero

    Hi picton2000,

    Try this while on the sheet in question (just initially on a copy of your data 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

  4. #4
    Registered User
    Join Date
    03-27-2013
    Location
    Wiltshire, England
    MS-Off Ver
    Excel 2007
    Posts
    75

    Re: Delete Row If All Values Are Zero

    Hello and thank you for your reply.
    The code you have given me works on the range of that particular example, but the number of rows and columns will be variable each time.
    I would need the code to assess column J and all columns to the right which will be variable on each report.

    Thanks

  5. #5
    Registered User
    Join Date
    03-27-2013
    Location
    Wiltshire, England
    MS-Off Ver
    Excel 2007
    Posts
    75

    Re: Delete Row If All Values Are Zero

    Hello Robert, thanks for your reply.

    I work in payroll where I may have 1,500 rows and 30 or 40 columns.
    I need a macro that will assess all columns from column J to the right, where the number of columns will be variable from week to week.

    Thanks
    Jonathan

  6. #6
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,523

    Re: Delete Row If All Values Are Zero

    Hello Robert, thanks for your reply.

    I work in payroll where I may have 1,500 rows and 30 or 40 columns.
    I need a macro that will assess all columns from column J to the right, where the number of columns will be variable from week to week.

    Thanks
    Jonathan
    No problem - try this (again while on the sheet in question and initially on a copy of your data as the results cannot be undone if they're not as expected):

    Please Login or Register  to view this content.
    Regards,

    Robert

  7. #7
    Registered User
    Join Date
    03-27-2013
    Location
    Wiltshire, England
    MS-Off Ver
    Excel 2007
    Posts
    75

    Re: Delete Row If All Values Are Zero

    Hello Robert,

    That works exactly as I require.
    Thank you for your time and effort in giving me a successful solution.

    Regards
    Jonathan

  8. #8
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,523

    Re: Delete Row If All Values Are Zero

    Hi Jonathan,

    Glad to hear it and you're welcome. Thanks for marking the thread as solved and the rep

    Regards,

    Robert

+ 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. Delete y-values based on x-values
    By JHCJ in forum Excel General
    Replies: 2
    Last Post: 02-16-2017, 01:31 PM
  2. [SOLVED] Help needed with VBA code to replace values with names and delete others Values
    By rv02 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 04-10-2015, 01:50 AM
  3. Delete duplicate values from cells containing multiple values
    By Buzzed Aldrin in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 01-03-2014, 02:50 PM
  4. [SOLVED] Delete Unique Values Macro Skipping Some Values
    By stockgoblin42 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-26-2013, 06:27 AM
  5. [SOLVED] Delete duplicate values and mantening unique values
    By ronald coletto in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-22-2013, 02:19 PM
  6. delete values between two other constant values..
    By newtothis in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-09-2011, 04:50 AM
  7. Exclude values and delete remaining values
    By BJ5352 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-11-2011, 02:36 AM

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