+ Reply to Thread
Results 1 to 5 of 5

Program a conditional script that will delete entire row if cell in column B is empty

Hybrid View

  1. #1
    Registered User
    Join Date
    01-22-2012
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    75

    Program a conditional script that will delete entire row if cell in column B is empty

    Can someone please help program a conditional script that will delete entire row if column B is empty?

    Thanks in advance!
    Last edited by Rabbitstew; 07-17-2012 at 01:29 PM. Reason: Correction

  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,259

    Re: Can someone please help program a conditional script that will delete entire row if A2

    Hello Rabbitstew,

    This will delete row 10 on the ActiveSheet if A2 contains no data.
        If Range("A2") ="" Then Rows(10).EntireRow.Delete
    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
    Registered User
    Join Date
    01-22-2012
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    75

    Re: Can someone please help program a conditional script that will delete entire row if A2

    Ooops, sorry I meant to say if Column B is empty then delete the entire row

  4. #4
    Registered User
    Join Date
    01-22-2012
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    75

    Re: Can someone please help program a conditional script that will delete entire row if A2

    Never mind, I got it:

    Sub DelRow()
    Range("B:B").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
    End Sub

    Thanks anyway!

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

    Re: Can someone please help program a conditional script that will delete entire row if A2

    Hello Rabbitstew,

    Do you want to delete a row if the cell in column "B" of that row is empty?

+ 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