+ Reply to Thread
Results 1 to 2 of 2

Delete entire rows if the two rows are empty

  1. #1
    Forum Contributor
    Join Date
    02-16-2011
    Location
    Maharashtra, Thane
    MS-Off Ver
    Excel 2021
    Posts
    140

    Delete entire rows if the two rows are empty

    Hi,
    I have a code which is mentioned below. It works fine. But one problem is there. It is working when we are select the cell. I need the same code for the whole sheet range. When macro will run it will detect multiple blank rows & delete it. For ex. If A3:E3 & A4:E4 is blank & your cursor is in A3 then it will work. Please modify the below code which will auto detect multiple blank rows & delete it.
    Code:
    If Application.WorksheetFunction.CountA( _
    Range("A" & ActiveCell.Row).Resize(2, 5)) = 0 Then
    ActiveCell.Resize(2, 1).EntireRow.Delete
    End If

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Delete entire rows if the two rows are empty

    shyampanda,

    Welcome to the forum. In the future, please wrap your code in code tags. As for your question, the following should work for you:
    Please Login or Register  to view this content.


    Hope that helps,
    ~tigeravatar

+ 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