Delete line if value in column C = ""

T

TheLeafs

Good day,

I have three columns of data in A, B & C. Data exists in column A & B
but in some cells in column C there is no data. I want to delete th
entire row if no data is found in column C. I have very limite
experience in writing macro's. I am wondering if someone can draw u
how I can get this started. The range of the data is from A2:C500.

Thanks for any help
 
B

Binzelli

Hi !

The following code should do the trick:


Sub DeleteEmptyC()

Dim Row As Long
Dim EndRow As Long

Row = 2
EndRow = 500


Do While Row <= EndRow

If IsEmpty(Cells(Row, 3)) Then
Rows(Row).Select
Selection.Delete Shift:=xlUp
'Subtract 1 from Row and EndRow for every row deleted
Row = Row - 1
EndRow = EndRow - 1
End If

Row = Row + 1
Loop

End Sub


Good luck
 
T

Thomas Ramel

Grüezi TheLeafs

TheLeafs schrieb am 23.06.2004
I have three columns of data in A, B & C. Data exists in column A & B,
but in some cells in column C there is no data. I want to delete the
entire row if no data is found in column C. I have very limited
experience in writing macro's. I am wondering if someone can draw up
how I can get this started. The range of the data is from A2:C500.

Use the following line:

Range("C:C").SpecialCells(xlCellTypeBlanks).EntireRow.Delete

--
Regards

Thomas Ramel
- MVP for Microsoft-Excel -

[Win XP Pro SP-1 / xl2000 SP-3]
 
G

Gord Dibben

If you don't need to use a macro try this.

Select Column C and Edit>Go To>Special>Blanks>OK

With all blanks in C selected......

Edit>Delete>Entire Row.

If you recorded a macro while doing it, you would get basically the same code
as Thomas posted. He has removed a few "select" statements.

Gord Dibben Excel MVP
 
Top