+ Reply to Thread
Results 1 to 10 of 10

Macro, If cell A has data but cell B is empty delete complete row

  1. #1
    Registered User
    Join Date
    07-19-2011
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    73

    Macro, If cell A has data but cell B is empty delete complete row

    I am looking for a macro that will delete the entire row if the "B" cell is empty, thanks in advance.

    Cell A Cell B
    server1 "C:\Windows
    server1 (delete this row)
    Last edited by stangz71; 07-28-2011 at 05:12 PM.

  2. #2
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127

    Re: Macro, If cell A has data but cell B is empty delete complete row

    Try something like this and report back:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    07-19-2011
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    73

    Re: Macro, If cell A has data but cell B is empty delete complete row

    It works great but would it be possible to shift the cells up so that it only leaves one row between the next row with data?

  4. #4
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127

    Re: Macro, If cell A has data but cell B is empty delete complete row

    As it stands, it shouldn't leave any empty rows. Do you want it to leave any empty row? Would it be better to just clear the contents out of the entire row instead of actually deleting the row?

  5. #5
    Registered User
    Join Date
    07-19-2011
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    73

    Re: Macro, If cell A has data but cell B is empty delete complete row

    For some reason it is leaving empty rows and just deleting the data from the cells. Ultimately, it would be nice to have something like the example below, one row between each cell with data. If this is too much, no worries, I appreciate the help you have given me so far.

    server1 C:\Windows
    (empty row)
    server2 E:\TI\
    (empty row)
    server3 C:\Word_Documents
    (empty row)
    server4 E:\Backup
    Last edited by stangz71; 07-28-2011 at 04:47 PM.

  6. #6
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127

    Re: Macro, If cell A has data but cell B is empty delete complete row

    Could you possibly post a sample of your workbook (use dummy data if necessary; also, I don't have Excel 2007, so xls format is needed)?

    I'd have no problems adding empty rows between your data, although I generally advise against doing so. Empty rows can make analysis more complicated. If you still do need blank rows, I modify the code once I've seen your workbook.

  7. #7
    Registered User
    Join Date
    07-19-2011
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    73

    Re: Macro, If cell A has data but cell B is empty delete complete row

    BigBas

    I just tested this on a different spreadsheet and realized that it does exactly what I need. The spacing is even across the cells and that is what I needed. Not sure why the spacing wasn't even on the first spreadsheet but it works fine now. Thanks again for your help.

  8. #8
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127

    Re: Macro, If cell A has data but cell B is empty delete complete row

    Not a problem stangz. Let us know if anything needs to be changed in the future.

  9. #9
    Registered User
    Join Date
    07-19-2011
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    73

    Re: Macro, If cell A has data but cell B is empty delete complete row

    Definitely, thanks.

  10. #10
    Registered User
    Join Date
    07-19-2011
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    73

    Re: Macro, If cell A has data but cell B is empty delete complete row

    BigBas

    Could you assist me with an outstanding request on the forum. If this is not possible, please let me know, thanks.

    http://www.excelforum.com/excel-prog...omparison.html

+ 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