clear row if first cell is empty

jp1983

Board Regular
Joined
Apr 25, 2007
Messages
84
Hi All,
having a little trouble trying to do the following.

A report is run, based on the values between A7:A31
This then populates info into cells B7:I31

However, if there is no value in one of the cells at the end, eg. A:28, A29, A30, A31 (the cells are sorted in order first, so you wouldnt get a random empty cell inbetween values) then it should just clear the contents for that entire row, so that #N/A, doesnt show.

please note i only want to clear out the cell content, not delete out an entire row.

this is something like what i need i think...

Code:
Sub ColorEmpty()
LastRow = Range("A65536").End(xlUp).Row
For i = 1 To LastRow
    If IsEmpty(Cells(i, 5)) Then
        Cells(i, 5).EntireRow.Delete
  End If
  Next i
 

End Sub
http://www.mrexcel.com/forum/showthread.php?t=307244&highlight=delete+empty+row
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Try...
Code:
Sub ClearBlanks()
    Range("A:A").SpecialCells(xlCellTypeBlanks).EntireRow.Clear
End Sub

Denis
 
Upvote 0
Just for clarification, the reason it didn't work is because the previous code was testing column E for blanks, not column A...
If IsEmpty(Cells(i, 5)) Then

should be

If IsEmpty(Cells(i, 1)) Then
 
Upvote 0

Forum statistics

Threads
1,214,547
Messages
6,120,139
Members
448,948
Latest member
spamiki

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top