+ Reply to Thread
Results 1 to 3 of 3

Delete rows if columns are blank

  1. #1
    Registered User
    Join Date
    02-16-2012
    Location
    Adelaide
    MS-Off Ver
    Excel 2003
    Posts
    42

    Delete rows if columns are blank

    Hi and thanks in advance.

    I need some VBA that will delete rows on a sheet based on user selection from a form listbox.

    If the user selects one or more columns from the listbox then I want to delete the rows on the active sheet that have blank cells in those columns.

    So if the user selects columns A, E, F and a row has blanks in all three of those columns, then I want to delete it.

    I currently have this code with removes rows that are completely blank ...


    Please Login or Register  to view this content.
    thanks
    Deutz

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Delete rows if columns are blank

    Hello Deutz,

    Welcome to the Forum!

    It would be best to post a copy of the workbook. This will provide a complete picture of what you are doing and reduce the number of questions needed before a solution is reached.

    To attach a file to your post, you need to be using the main 'New Post' or 'New Thread' page and not 'Quick Reply'.
    To use the main 'New Post' page, click the 'Post Reply' button in the relevant thread.


    On this page, below the message box, you will find a button labelled 'Manage Attachments'.
    Clicking this button will open a new window for uploading attachments.


    You can upload an attachment either from your computer or from another URL by using the appropriate box on this page.
    Alternatively you can click the Attachment Icon to open this page.


    To upload a file from your computer, click the 'Browse' button and locate the file.


    To upload a file from another URL, enter the full URL for the file in the second box on this page.
    Once you have completed one of the boxes, click 'Upload'.


    Once the upload is completed the file name will appear below the input boxes in this window.
    You can then close the window to return to the new post screen.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Valued Forum Contributor
    Join Date
    12-05-2011
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010 & 2013
    Posts
    308

    Re: Delete rows if columns are blank

    Hi

    This function will test whether the row has a blank cell in the columns:
    Please Login or Register  to view this content.
    Example:
    Please Login or Register  to view this content.
    This would test for cells B12, D12 and F12 being blank, and return true if they were.
    The input is TestBlanks (row, col1, col2, col3, col4) - columns 2-4 are optional.
    Hope this helps.

    You just need to read the list box and pass on the columns to test.

    Best regards, Rob.

+ 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